php - enable to send mail via PhpMailer? -
i have configure , install composer in project,i require autoload.php
file file send mail.my login details correct while running application m getting smtp error: password command failed
i have included detailed error below.please me sort out problem
<?php require_once 'vendor/vendor/autoload.php'; $m = new phpmailer; $m->issmtp(); $m->smtpauth = true; $m->smtpdebug = 2; $m->host= 'smtp.gmail.com'; $m->username = 'suhasgawde10@gmail.com'; $m->password = '*************'; $m->smtpsecure = 'ssl'; $m->port = 465; $m->from = 'suhasgawde10@gmail.com'; $m->fromname = 'suhas gawde'; $m->addreplyto('suhasgawde10@gmail.com','reply address'); $m->addaddress('suhasgawde10@gmail.com','suhas gawde'); $m->subject = "here subject"; $m->body = 'this mailed send throught php mailer'; $m->altbody= 'this mailed send throught php mailer'; if(!$m->send()){ echo "mailer error: " . $m->errorinfo; } else{ echo 'success'; } ?>
error while running file :
2015-06-25 10:48:42 server -> client: 220 mx.google.com esmtp si7sm29610201pbc.54 - gsmtp 2015-06-25 10:48:42 client -> server: ehlo localhost 2015-06-25 10:48:43 server -> client: 250-mx.google.com @ service, [59.182.41.18] 250-size 35882577 250-8bitmime 250-auth login plain xoauth2 plain- clienttoken xoauth 250-enhancedstatuscodes 250-pipelining 250- chunking 250 smtputf8 2015-06-25 10:48:43 client -> server: auth login 2015-06-25 10:48:43 server -> client: 334 vxnlcm5hbwu6 2015- 06-25 10:48:43 client -> server: c3voyxnnyxdkztewqgdtywlslmnvbq== 2015-06-25 10:48:44 server -> client: 334 ugfzc3dvcmq6 2015-06-25 10:48:44 client -> server: z2fuyxbhdglamtawoa== 2015-06-25 10:48:44 server - > client: 534-5.7.14 please log in via web browser , 534- 5.7.14 try again. 534-5.7.14 learn more @ 534 5.7.14 https://support.google.com/mail/answer/78754 si7sm29610201pbc.54 - gsmtp 2015-06-25 10:48:44 smtp error: password command failed: 534-5.7.14 please log in via web browser , 534-5.7.14 try again. 534-5.7.14 learn more @ 534 5.7.14 https://support.google.com/mail/answer/78754 si7sm29610201pbc.54 - gsmtp 2015-06-25 10:48:44 smtp error: not authenticate. 2015-06-25 10:48:44 client -> server: quit 2015-06-25 10:48:45 server -> client: 221 2.0.0 closing connection si7sm29610201pbc.54 - gsmtp 2015-06-25 10:48:45 smtp connect() failed. https://github.com/phpmailer/phpmailer/wiki/troubleshooting mailer error: smtp connect() failed. https://github.com/phpmailer/phpmailer/wiki/troubleshooting
while using $m->smtpsecure = 'ssl';
openssl extension should enabled
in php.ini file remove semicolon line ;extension=php_openssl.dll
(if available)
or
you can try 'tls' smtpsecure
$m->smtpsecure = 'tls'; $m->host = 'smtp.gmail.com'; $m->port = 587;
check setting hope help
Comments
Post a Comment