email - sending mail to gmail with an php script -


1.using xampp , localhost trying send mail gmil php script.
2.after trying changes files php.ini , sendmail.ini seen in posts , other resources can't receive mail following php line of code:

    <?php     mail('satanower1@gmail.com','hello test','from: satanower1@gmail.com');     echo 'mail has been sent successfully.';     ?> 

i echo statement no email @ inbox.
changes tried sendmail.ini
file:smtp_server=smtp.gmail.com xampp defoult smtp_port=465 (i tried other ports 25 etc..)

changes tried php.ini file: smtp = smtp.gmail.com , smtp_port = 465

any available?

you need enable smtp access in gmail, need allow unsecure clients:

https://www.google.com/settings/security/lesssecureapps https://support.google.com/mail/answer/75726

sendmail config

[sendmail] smtp_server=smtp.gmail.com smtp_port=465 smtp_ssl=auto error_logfile=error.log debug_logfile=debug.log auth_username==*****@gmail.com auth_password=********* force_sender=*****@gmail.com 

php config

[mail function] smtp=smtp.gmail.com smtp_port=465 sendmail_from = *****@gmail.com sendmail_path = "\"c:\xampp\sendmail\sendmail.exe\" -t" 

Comments