OilSheikh Posted April 15, 2007 Share Posted April 15, 2007 Hi, I am trying to run this code and I keep on getting the error message : Warning: mail() [function.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\ZSOFT\XAMPP\xampp\htdocs\register.php on line 96 Any ideas, guys? ######### SEND A REGISTRATION CONFIRMATION E-MAIL ########## if ($adduser) { $recipient = "'".$_POST['email']."'"; $subject = "Registartion Confirmation"; $mailheaders = "From: Express PC Sales <xxx@hotmail.com> \n"; $msg = "Thank you for registering at Express PC Sales. Your Account is now active. <br><br> If you DID NOT register on our site, please reply back and your account will be removed from our system."; mail($recipient, $subject, $msg, $mailheaders); } ?> Btw, I m doing this from localhost AND the FROM e-mail must be xxx@hotmail.com. Any help would greatly be appreciated. Tnx. Quote Link to comment https://forums.phpfreaks.com/topic/47056-problem-setting-up-php-to-use-mail/ Share on other sites More sharing options...
MadTechie Posted April 15, 2007 Share Posted April 15, 2007 verify your "SMTP" and "smtp_port" setting in php.ini Quote Link to comment https://forums.phpfreaks.com/topic/47056-problem-setting-up-php-to-use-mail/#findComment-229532 Share on other sites More sharing options...
OilSheikh Posted April 16, 2007 Author Share Posted April 16, 2007 I changed my PHP.INI file. [mail function] ; For Win32 only. SMTP = mail.hotmail.com smtp_port = 25 ; For Win32 only. sendmail_from = zahidworld@hotmail.com And this is the updated PHP code I am using ######### SEND A REGISTRATION CONFIRMATION E-MAIL ########## if ($adduser) { $emailaddress = "'".$_POST['email']."'"; $to = $emailaddress; $subject = "Registartion Confirmation"; $header = "from: Express PC Sales <xxx@hotmail.com>"; $message = "Thank you for registering at Express PC Sales. Your Account is now active. \n\n If you DID NOT register on our site, please reply back and your account will be removed from our system."; $sentmail = mail($to,$subject,$message,$header); ### Line 100 } Upon running it, I get this error: [b]Warning: mail() [function.mail]: Failed to connect to mailserver at "mail.hotmail.com" port 251, verify your "SMTP" and "smtp_port" setting in php.ini or use ini_set() in C:\Program Files\ZSOFT\XAMPP\xampp\htdocs\register.php on line 100 [/b] Quote Link to comment https://forums.phpfreaks.com/topic/47056-problem-setting-up-php-to-use-mail/#findComment-230824 Share on other sites More sharing options...
MadTechie Posted April 17, 2007 Share Posted April 17, 2007 you can't use hotmail.. Quote Link to comment https://forums.phpfreaks.com/topic/47056-problem-setting-up-php-to-use-mail/#findComment-231519 Share on other sites More sharing options...
Recommended Posts
Join the conversation
You can post now and register later. If you have an account, sign in now to post with your account.