Click here to Skip to main content
15,908,674 members
Please Sign up or sign in to vote.
1.00/5 (1 vote)
See more:
Hi I have the following coding to send mail

ini_set("sendmail_from", '');
$to = "";
$subject = "test from localhost";
$msg = "I completely understand SMTP servers now!";
$headers = "From:\nReply-To:";
$config = "";
mail("$to", "$subject", "$msg", "$headers", "$config");
echo "finished!";

But i am getting the warning as Warning: mail() [function.mail]: Failed to connect to mailserver at port 25, verify your "SMTP" and "smtp_port" setting in php.ini or use ini_set().
How to solve this?

1 solution

The SMTP parameter is not an email address but the DNS name or IP address of the SMTP server that will process the mail message. I guess the content of your message needs to have the word "completely" replaced by "don't".
Share this answer

This content, along with any associated source code and files, is licensed under The Code Project Open License (CPOL)

CodeProject, 20 Bay Street, 11th Floor Toronto, Ontario, Canada M5J 2N8 +1 (416) 849-8900