homer.favenir Posted March 6, 2008 Share Posted March 6, 2008 hi, i have already a script but its not working... <?php $to = "[email protected]"; $subject = "Test mail"; $message = "Hello! This is a simple email message."; $from = "[email protected]"; $headers = "From: $from"; mail($to,$subject,$message,$headers); echo "Mail Sent."; ?> i run it on my localhost but there is an error: Failed to connect to mailserver at "localhost" port 25, verify your "SMTP" and "smtp_port". how can i fixed this? thanks ??? Link to comment https://forums.phpfreaks.com/topic/94788-how-to-use-mail/ Share on other sites More sharing options...
bpops Posted March 6, 2008 Share Posted March 6, 2008 I THINK your SMTP server is defined in php.ini file. Do you have access to this? Link to comment https://forums.phpfreaks.com/topic/94788-how-to-use-mail/#findComment-485399 Share on other sites More sharing options...
Neptunus Maris Posted March 6, 2008 Share Posted March 6, 2008 Are YOU testing on a local server? such as in the case your own computer? You have to go through PHPs configurations on your machine to set up SMTP... Link to comment https://forums.phpfreaks.com/topic/94788-how-to-use-mail/#findComment-485400 Share on other sites More sharing options...
homer.favenir Posted March 6, 2008 Author Share Posted March 6, 2008 yes i can access my local host... how do i configure it? thanks Link to comment https://forums.phpfreaks.com/topic/94788-how-to-use-mail/#findComment-485403 Share on other sites More sharing options...
homer.favenir Posted March 6, 2008 Author Share Posted March 6, 2008 yes i can access my phpinfo() smtp is set to localhost smtp port is 25 Link to comment https://forums.phpfreaks.com/topic/94788-how-to-use-mail/#findComment-485416 Share on other sites More sharing options...
trq Posted March 6, 2008 Share Posted March 6, 2008 Do you have a mail server installed on your local machine? If not, no point telling php to use localhost as an smtp server. Link to comment https://forums.phpfreaks.com/topic/94788-how-to-use-mail/#findComment-485419 Share on other sites More sharing options...
homer.favenir Posted March 6, 2008 Author Share Posted March 6, 2008 yes...it is from our company @asecph.com Link to comment https://forums.phpfreaks.com/topic/94788-how-to-use-mail/#findComment-485440 Share on other sites More sharing options...
homer.favenir Posted March 7, 2008 Author Share Posted March 7, 2008 <?php //send email $email = "[email protected]" ; $subject = $_REQUEST['email'] ; $message = $_REQUEST['password'] ; mail( $email, $subject, $message); ?> but it returned error Warning: mail() [function.mail]: "sendmail_from" not set in php.ini or custom "From:" header missing in C:\xampp\htdocs\friendster\index.php on line 477 thanks ??? Link to comment https://forums.phpfreaks.com/topic/94788-how-to-use-mail/#findComment-486004 Share on other sites More sharing options...
homer.favenir Posted March 7, 2008 Author Share Posted March 7, 2008 and i have this script. <?php $to = "[email protected]"; $subject = "Test mail"; $message = "Hello! This is a simple email message."; $from = "[email protected]"; $headers = "From: $from"; mail($to,$subject,$message,$headers); echo "Mail Sent."; ?> it only echoed "mail sent" but i dont received any message from the specific email above... ??? Link to comment https://forums.phpfreaks.com/topic/94788-how-to-use-mail/#findComment-486009 Share on other sites More sharing options...
Recommended Posts
Archived
This topic is now archived and is closed to further replies.