I used the mail () function in php encoding but I was not able to send any mail. Before continuing, I want to clarify the context for using the mail () function.
I did not host my site so that it was on localhost. I set smtp, sendmail_path port, etc.
After a lot of searching, it seems to me that I need to download the mail server. I downloaded the free sendmail server and configured it as the intended site. However, all in vain, someone told me that I can not use the mail function until I host my site not only on localhost. Please guide me.
<?php
$from = "oooo@hotmail.com";
$subject = " My cron is working";
$message = "My first Cron :)";
$message = wordwrap($message, 70);
ini_set("SMTP","localhost");
ini_set("smtp_port","25");
ini_set("sendmail_from","00000@gmail.com");
ini_set("sendmail_path", "C:\wamp\bin\sendmail.exe -t");
mail("jXXXXXX@gmail.com",$subject,$message,"From: $from\n");
echo "Thank you for sending us feedback";
?>
this sendmail configuration file:
smtp_server=smtp.gmail.com
smtp_port=587
smtp_ssl=auto
;default_domain=domain.com
auth_username=jxxxx@gmail.com
auth_password=8888
force_sender=j*****@gmail.com
( ! ) SCREAM: Error suppression ignored for
( ! ) Warning: mail() [<a href='function.mail'>function.mail</a>]: Failed to connect to mailserver at "localhost" port 25, verify your "SMTP" and "smtp_port" setting in php.ini or use ini_set() in C:\wamp\www\test.php on line 20
source
share