Showing results for 
Show  only  | Search instead for 
Did you mean: 

simple php email script not working

I am using a script like this...



$to = '';
$subject = 'the subject';
$message = 'hello';
$headers = 'From:' . "\r\n" .
'Reply-To:' . "\r\n" .
'X-Mailer: PHP/' . phpversion();

mail($to, $subject, $message, $headers);


....what do I need to do to get this to work?


Re: simple php email script not working

Hi @codenamejupiter , thanks for posting.

If you are using a cPanel hosting plan and sending mail using PHP mail(), you should use 'localhost' as the server or not specify a server.

You will also want to ensure that the "From" address uses a domain name associated with your hosting plan.

If you continue to have trouble, please follow up with a detailed error message and a member of the Community might be able to offer some additional suggestions.


Gary - GoDaddy | Community Moderator
24/7 Support | Check System Status