lhbdan Posted March 16, 2011 Share Posted March 16, 2011 I understand you need to use the mail() command but this just wont work for me, my webserver is with godaddy, and they sent me an email saying that i need to use a relay server to send my mail, how do i set this up or anything? Quote Link to comment https://forums.phpfreaks.com/topic/230848-how-to-send-mail/ Share on other sites More sharing options...
Eyewash01 Posted March 18, 2011 Share Posted March 18, 2011 The mail function can only work if you have told PHP which mail server to use to send the mail out. If you are in control of your server, you need to set the smtp server in your php.ini file. If you are on shared hosting, then they should be able to set this up for you. Quote Link to comment https://forums.phpfreaks.com/topic/230848-how-to-send-mail/#findComment-1188960 Share on other sites More sharing options...
tnhillbilly Posted March 18, 2011 Share Posted March 18, 2011 I think this is what i'm using at work for production equipment to send status info. In php.ini do the following: [mail function] ; For Win32 only. SMTP = mail.subdomain.domain.org <<<---- fix this line, get it from your email program smtp_port = 25 ; For Win32 only. sendmail_from = [email protected] <<<- fix the sent from address. Restart Apache. Here’s the php code. <?php $to = "[email protected]"; $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>"); } ?> Quote Link to comment https://forums.phpfreaks.com/topic/230848-how-to-send-mail/#findComment-1188967 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.