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

simple php email script not working

I am using a script like this...

 

 

<?php
$to = 'someone@somewhere.com';
$subject = 'the subject';
$message = 'hello';
$headers = 'From: example.com' . "\r\n" .
'Reply-To: example.com' . "\r\n" .
'X-Mailer: PHP/' . phpversion();
relay-hosting.secureserver.net

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

 

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

1 REPLY 1
Moderator
Moderator

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