ident Posted September 20, 2009 Share Posted September 20, 2009 <?php //add the header include('header.php'); //define the receiver of the email $to = 'sam@globular.org'; //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: myemail@mail.com\r\nReply-To: myemail@mail.com"; //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? Quote 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 Quote 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 Quote 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 Quote 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? Quote 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... Quote 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: Quote 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 = 'sam@globular.org'; //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: myemail@mail.com\r\nReply-To: myemail@mail.com"; //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> Quote 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 Quote 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 Quote Link to comment https://forums.phpfreaks.com/topic/174892-solved-email-not-working/#findComment-921755 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.