Jump to content

Recommended Posts

Hi to all,

i need some help about e mail sending.i am basic learner of php.

<?php
$to="shyamprasad5292001@gmail.com";
$subject="test mail";
$message="hello!shyam this is sample mail to you.";
$from="shyamprasad_5292001@yahoo.com";
$headers="From:$from";
mail($to,$subject,$message,$headers);
echo "mail sent";
?>

when i run this script i got following errors.how to fix these problems.

 

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:\easyphp1-8\www\mail.php on line 7

 

i am working on local host.i opened php.ini and saw this SMTP and smtp_port variable.please any one explain all modification in php.ini  and reqiurements to send a mail.

Link to comment
https://forums.phpfreaks.com/topic/49751-mail-function-help/
Share on other sites

Ummm first off let's make sure you can connect to your mail server....

 

Hit start->run then type "cmd" no quotes

 

type "telnet localhost 25" no quotes and see if it connects....

 

If it doesn't then it's a problem with your mail server ;p.

 

(PS telnet doesn't come installed with Vista)

Link to comment
https://forums.phpfreaks.com/topic/49751-mail-function-help/#findComment-244051
Share on other sites

This thread is more than a year old. Please don't revive it unless you have something important to add.

Join the conversation

You can post now and register later. If you have an account, sign in now to post with your account.

Guest
Reply to this topic...

×   Pasted as rich text.   Restore formatting

  Only 75 emoji are allowed.

×   Your link has been automatically embedded.   Display as a link instead

×   Your previous content has been restored.   Clear editor

×   You cannot paste images directly. Upload or insert images from URL.

×
×
  • Create New...

Important Information

We have placed cookies on your device to help make this website better. You can adjust your cookie settings, otherwise we'll assume you're okay to continue.