ident Posted September 20, 2009 Share Posted September 20, 2009 <?php //add the header include('header.php'); //define the receiver of the email $to = '[email protected]'; //define the subject of the email $subject = 'Test email'; //define the message to be sent. Each line should be separated with \n $message = "Hello World!\n\nThis is my first mail."; //define the headers we want passed. Note that they are separated with \r\n $headers = "From: [email protected]\r\nReply-To: [email protected]"; //send the email $mail_sent = @mail( $to, $subject, $message, $headers ); //if the message is sent successfully print "Mail sent". Otherwise print "Mail failed" echo $mail_sent ? "<br /><center>Mail sent" : "Mail failed</center>"; ?> any one know why? Link to comment https://forums.phpfreaks.com/topic/174892-solved-email-not-working/ Share on other sites More sharing options...
RussellReal Posted September 20, 2009 Share Posted September 20, 2009 remove the @ from infront of 'mail' and it will show errors and warnings etc, also, if you don't have a mail server than it won't work read mail Link to comment https://forums.phpfreaks.com/topic/174892-solved-email-not-working/#findComment-921684 Share on other sites More sharing options...
ident Posted September 20, 2009 Author Share Posted September 20, 2009 I did what you said. No errors displayed. Just displayed mail sent. I have my own email server Link to comment https://forums.phpfreaks.com/topic/174892-solved-email-not-working/#findComment-921699 Share on other sites More sharing options...
work_it_work Posted September 20, 2009 Share Posted September 20, 2009 something is wrong with ur server i guess, check your mail functions in php.ini file Link to comment https://forums.phpfreaks.com/topic/174892-solved-email-not-working/#findComment-921708 Share on other sites More sharing options...
ident Posted September 20, 2009 Author Share Posted September 20, 2009 Hmm maybe it's something iv not set up then. I have my own email server that i use. But i have only just hosted my site to my server and then added this code. You mention a php.ini, but i have never write or seen one. is there something i must set up first on my server then? Link to comment https://forums.phpfreaks.com/topic/174892-solved-email-not-working/#findComment-921711 Share on other sites More sharing options...
work_it_work Posted September 20, 2009 Share Posted September 20, 2009 huh, so you have host not server, i think this is why it's not working... php.ini file can be found in php server folder, i don't think you have access to that file if you have only host if your host allows you to use SMTP your problem can be solved. just look at your host options and see then post here yes or no btw, if you have free hosting services it won't work your method since they protect from spammers... Link to comment https://forums.phpfreaks.com/topic/174892-solved-email-not-working/#findComment-921714 Share on other sites More sharing options...
ident Posted September 20, 2009 Author Share Posted September 20, 2009 huh, so you have host not server, i think this is why it's not working... php.ini file can be found in php server folder, i don't think you have access to that file if you have only host if your host allows you to use SMTP your problem can be solved. just look at your host options and see then post here yes or no Hi, I have my own server that i pay alot of money for. But i have not much idea about it as my mate set it up for me. I brought it from ovh Your server is a Debian 5.0 (Lenny) based system. Please find below the connection settings to your server. SETTINGS SERVER: Link to comment https://forums.phpfreaks.com/topic/174892-solved-email-not-working/#findComment-921718 Share on other sites More sharing options...
work_it_work Posted September 20, 2009 Share Posted September 20, 2009 talk to your buddy and solve the problem. the script woks perfect. you may check your email to see you've got one email, and was sent with your script and my hosted domain... copy of the file used to send you the email: <html> <body> <?php //add the header include('header.php'); //define the receiver of the email $to = '[email protected]'; //define the subject of the email $subject = 'Test email - work it work server test'; //define the message to be sent. Each line should be separated with \n $message = "Hello World!\n\nThis is my first mail. <br> just uploaded your script on my host and it works"; //define the headers we want passed. Note that they are separated with \r\n $headers = "From: [email protected]\r\nReply-To: [email protected]"; //send the email $mail_sent = @mail( $to, $subject, $message, $headers ); //if the message is sent successfully print "Mail sent". Otherwise print "Mail failed" echo $mail_sent ? "<br /><center>Mail sent" : "Mail failed</center>"; ?> <body> Link to comment https://forums.phpfreaks.com/topic/174892-solved-email-not-working/#findComment-921724 Share on other sites More sharing options...
ident Posted September 20, 2009 Author Share Posted September 20, 2009 i did wonder who that come from lol. thanks i will do Link to comment https://forums.phpfreaks.com/topic/174892-solved-email-not-working/#findComment-921740 Share on other sites More sharing options...
work_it_work Posted September 20, 2009 Share Posted September 20, 2009 no problem, this is why this forum was created good luck! PS i guess the topic is solved Link to comment https://forums.phpfreaks.com/topic/174892-solved-email-not-working/#findComment-921755 Share on other sites More sharing options...
Recommended Posts
Archived
This topic is now archived and is closed to further replies.