I am testing to send mail form localhost using gmail smtp,
I have made following setting
C:\wamp\sendmail\sendmail.ini
smtp_server=smtp.gmail.com
;smtp port (normally 25)
smtp_port=465
smtp_ssl=ssl
default_domain=localhost
error_logfile=error.log
;debug_logfile=debug.log
auth_username = at*******t@gmail.com
auth_password = my*********password
php.ini
.
extension=php_smtp.dll
.
.
[mail function]
; For Win32 only.
; http://php.net/smtp
; SMTP = smtp.gmail.com
; http://php.net/smtp-port
; smtp_port = 25
; For Win32 only.
; http://php.net/sendmail-from
; sendmail_from = at*******t@gmail.com
; For Unix only. You may supply arguments as well (default: "sendmail -t").
; http://php.net/sendmail-path
sendmail_path = "C:\wamp\sendmail\sendmail.exe -t -i"
index.php
<?php
$to = "towhomemailid@gmail.com";
$subject = "My subject";
$txt = "Hello world!";
$headers = "From: at*******t@gmail.com@gmail.com" . "\r\n" .
"CC: anothermailid@gmail.com";
$a = mail($to,$subject,$txt,$headers);
var_dump($a);
?>
Output
false
I have enabled the IMAP setting in gmail account as well,
Also enabled the php_smtp, php_openssl, php_sockets
under PHP extensions
When I tried I am getting a security mail in gmail that there is one suspicious login and I have added this device to known one as well, it seems the script is hitting the gmail account but return is getting false.
What possible change I am missing?
EDIT:
I tried with an enterprise email id ..
enterpriseemailid@example.com
it was working but not with my perswonal id, even the two step verification is off, so error seems to be somewhere in google setting, can anyone suggest possible solution