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 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 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 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>"); } ?> 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 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. 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 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 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? 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. Link to comment https://forums.phpfreaks.com/topic/249370-mail-wont-work/#findComment-1280446 Share on other sites More sharing options...
Recommended Posts
Archived
This topic is now archived and is closed to further replies.