I have the following code which sets up the SMTP server:
ini_set("send_from", "test@gmail.com");
ini_set("SMTP", "smtp.gmail.com");
and i create a simple mail in this way:
mail("test@yahoo.com", "A subject", "My message for you", "From: TEST");
When I run this code, it fails to send mail to Yahoo e.g. some.email@yahoo.com. But when i use any Gmail mail address as the first argument, it works.
What’s wrong ?
In thi case you dont auth (user name passwort) and dont usw tls. This wont be accepted.
Better use this:
XAMPP Sendmail using Gmail account
or an framework to send emails via smtp like
Zend Mail Gmail SMTP
http://framework.zend.com/manual/1.12/en/zend.mail.sending.html
Here a code example
http://framework.zend.com/downloads/latest#ZF1