Cultureshock Posted December 9, 2009 Share Posted December 9, 2009 I haven't heard anything from my host about the mail not working, so could someone instruct me on how to use php to email stuff? Here's what I have so far: <?php $email = $_POST['email']; $name = $_POST['name']; $to = "[email protected]"; $subject = "hey, " . $name . " requests an invite."; $body = "Through site form. Email: ".$name." ... ... ... "; $headers = "From: [email protected]\r\n" . "X-Mailer: Cultureshock"; if (mail($to, $subject, $body, $headers)) { header('location:/register.php?action=win'); }else{ header('location:/register.php?action=lose'); }; ?> Quote Link to comment https://forums.phpfreaks.com/topic/184489-mail-not-working/ Share on other sites More sharing options...
corrupshun Posted December 9, 2009 Share Posted December 9, 2009 I think the codes good but you need an smtp server to send email through php -- ALSO do you get an error code? what exactly is the problem? Quote Link to comment https://forums.phpfreaks.com/topic/184489-mail-not-working/#findComment-973888 Share on other sites More sharing options...
arunner Posted December 9, 2009 Share Posted December 9, 2009 it might work if you get rid of the word "vir.us" Quote Link to comment https://forums.phpfreaks.com/topic/184489-mail-not-working/#findComment-973893 Share on other sites More sharing options...
Cultureshock Posted December 9, 2009 Author Share Posted December 9, 2009 it might work if you get rid of the word "vir.us" --- If that wasn't a url domain, I might do that ALSO do you get an error code? what exactly is the problem? --- It works, but it doesn't send the email. Quote Link to comment https://forums.phpfreaks.com/topic/184489-mail-not-working/#findComment-973897 Share on other sites More sharing options...
forumforme123 Posted December 9, 2009 Share Posted December 9, 2009 Try this: http://deepakssn.blogspot.com/2006/06/gmail-php-send-email-using-php-with.html It worked for me. Quote Link to comment https://forums.phpfreaks.com/topic/184489-mail-not-working/#findComment-973921 Share on other sites More sharing options...
oni-kun Posted December 9, 2009 Share Posted December 9, 2009 Huh. Anyway, Telnet your mail server. Usually mail/smtp.yourdomain.com with port 25. If this is unreachable, than I doubt you can e-mail from it. This is the only way you can physically send an e-mail, without using a third party SMTP host. Quote Link to comment https://forums.phpfreaks.com/topic/184489-mail-not-working/#findComment-973925 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.