Click here to Skip to main content
15,949,809 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

PHP
ini_set("SMTP","xxxx@example.com");
ini_set("smtp_port","25");
ini_set("sendmail_from", 'xxxx@example.com');
$to = "xxxx@example.com";
$subject = "test from localhost";
$msg = "I completely understand SMTP servers now!";
$headers = "From: localhost@localhost.com\nReply-To: localhost@localhost.com";
$config = "-stfu@noob.com";
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 xxxx@example.com port 25, verify your "SMTP" and "smtp_port" setting in php.ini or use ini_set().
How to solve this?
Posted

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