patchido Posted October 19, 2011 Share Posted October 19, 2011 well, i have a hosting site and i enter via cpanel,(just in case it matters) and i am trying to use the mai() function but it won't work.. :S this is my code <?php $to = "pato.llaguno@gmail.com"; $subject = "Hi!"; $body = "Hi,\n\nHow are you?"; if (mail($to, $subject, $body)) { echo("<p>Message successfully sent!</p>"); } else { echo("<p>Message delivery failed...</p>"); } ?> the output is Message successfully sent! but i don't get any mail in the adress specified :S Quote Link to comment https://forums.phpfreaks.com/topic/249370-mail-wont-work/ Share on other sites More sharing options...
voip03 Posted October 19, 2011 Share Posted October 19, 2011 Try with header http://php.net/manual/en/function.mail.php Quote Link to comment https://forums.phpfreaks.com/topic/249370-mail-wont-work/#findComment-1280422 Share on other sites More sharing options...
patchido Posted October 19, 2011 Author Share Posted October 19, 2011 <?php $to = 'pato.llaguno@gmail.com'; $subject = 'the subject'; $message = 'hello'; $headers = 'From: webmaster@example.com' . "\r\n" . 'Reply-To: webmaster@example.com' . "\r\n" . 'X-Mailer: PHP/' . phpversion(); if(mail($to, $subject, $message, $headers)){ echo("<p>Message successfully sent!</p>"); } else { echo("<p>Message delivery failed...</p>"); } ?> same thing :S Quote Link to comment https://forums.phpfreaks.com/topic/249370-mail-wont-work/#findComment-1280423 Share on other sites More sharing options...
voip03 Posted October 19, 2011 Share Posted October 19, 2011 <?php $from = "PHP Freak"; $headers = "MIME-Version: 1.0\r\n"; $headers.= "Content-type: text/html; charset=iso-8859-1\r\n"; $headers.= "From: $from\r\n"; $to = "pato.llaguno@gmail.com"; $subject = "Email send!"; $body = "Hi,Email working?"; if (mail($to, $subject, $body,$headers)) { echo("<p>Message successfully sent!</p>"); } else { echo("<p>Message delivery failed...</p>"); } ?> Quote Link to comment https://forums.phpfreaks.com/topic/249370-mail-wont-work/#findComment-1280426 Share on other sites More sharing options...
patchido Posted October 19, 2011 Author Share Posted October 19, 2011 i got that mail Quote Link to comment https://forums.phpfreaks.com/topic/249370-mail-wont-work/#findComment-1280427 Share on other sites More sharing options...
voip03 Posted October 19, 2011 Share Posted October 19, 2011 That good. Have fun with Mail. Mark it SOLVED. Quote Link to comment https://forums.phpfreaks.com/topic/249370-mail-wont-work/#findComment-1280430 Share on other sites More sharing options...
patchido Posted October 19, 2011 Author Share Posted October 19, 2011 huh?? i meant i got the mail u sent, not working for me Quote Link to comment https://forums.phpfreaks.com/topic/249370-mail-wont-work/#findComment-1280431 Share on other sites More sharing options...
voip03 Posted October 19, 2011 Share Posted October 19, 2011 try this http://www.w3schools.com/php/php_ref_mail.asp Quote Link to comment https://forums.phpfreaks.com/topic/249370-mail-wont-work/#findComment-1280434 Share on other sites More sharing options...
patchido Posted October 19, 2011 Author Share Posted October 19, 2011 what exactl am i suposed to do? Quote Link to comment https://forums.phpfreaks.com/topic/249370-mail-wont-work/#findComment-1280441 Share on other sites More sharing options...
voip03 Posted October 19, 2011 Share Posted October 19, 2011 check php.ini file and change the Mail configuration values. Quote Link to comment https://forums.phpfreaks.com/topic/249370-mail-wont-work/#findComment-1280446 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.