PHP Mail

I got this error

Warning: mail(): Failed to connect to mailserver at "localhost" port 25, verify your "SMTP" and "smtp_port" setting in php.ini or use ini_set() in D:\hshome\nextrex\grafxdesigns.net\p_sendmail.php on line 49

Any idea what's wrong?

Thanks
 
I have the similar problem in my site.

I have error message when i trying to call mail(....) function in my php script. The error look like this:

Warning: mail(): Failed to connect to mailserver at "localhost" port 25, verify your "SMTP" and "smtp_port" setting in php.ini or use ini_set() in D:\hshome\......\index.php on line 303

What's wrong?
 
Please specify your mail server instead of "localhost"
Your mail server would be - mail.yourdomain.com (replace yourdomain.com with your actual domain)
 
hey i have a simillar porblem too....i am running easyphp i got from some site and when i run the mailing script it say's....
i am running it from my compute (the server @ localhost)

Warning mail() Failed to connect to mailserver at localhost port 25, verify your SMTP and smtp_port setting in php.ini or use ini_set() in cprogram filesserver stuffeasyphp1-7wwwindex.php on line 68..


can someone please help....
 
it acutally...


Warning mail() 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:\Program Files\server stuff\EasyPHP1-7\www\index.php on line 68..
 
I get this message when I try to submit a form using php - I've got easy php installed (with apache and mysql) and the SMTP and smtp_port settings are correct. I don't have a mail server on my machine. Where am I going wrong? Thanks for any help!


Warning: mail(): Failed to connect to mailserver at "mail.btinternet.com" port 25, verify your "SMTP" and "smtp_port" setting in php.ini or use ini_set() in c:\easyphp1-7\www\feedback1.php on line 12
 
<?php

ini_set("SMTP","mail.domain.com");
ini_set("sendmail_from","[email protected]");

if (mail("[email protected]","This is a test","This is the body","From: [email protected]\r\nContent-type: text/plain\r\n\r\n"))
{
print "Success";
}
else
{
print "Failed";
}

?>
They require you to specify the SMTP server AND a valid From address for the domain, and the 'From:' setting in the header isn't good enough. You have to use ini_set() for both.
 
$message = "$realname, $email\n\n$feedback";

this variable is not working in my mail funciton

mail("[email protected]",$subject,$message,"From: $email");

i want body to displey in a new row, but mail function does not accept "\n"! What am i doing wrong?
 
Replace your \n's with \r\n's in your message string.

Strictly speaking, you're supposed to separate lines with carriage return+line feed.
 
Thank you rabbit.

I just started learning PHP, and this is my first programing language. It's more like playing with examples than actual learning.

It works fine now. Thanks once again...
 
Hmm... yesterday it worked just fine, but thismorning I get this:

Warning: mail(): SMTP server response: 552 sorry, your envelope sender domain must exist (#5.7.1) in...

I tried to search the web but ended up in dead corners every time...
 
Back
Top