ewoudwempe52
New Member
- Messages
- 1
- Reaction score
- 0
- Points
- 0
When I try to mail, with php's mail function, no email is send, and it returns false. What can I do to solve this? Or is there another mail function?
Ewoud
Ewoud
I am setting up a CMS and having a similar problem with user registration verification e-mails not being sent out. I am in the process of checking things at the CMS end, but if there is an issue with outgoing php mail then it would save me a lot of time if you could let me know.
Thanks
Oh hosting server is starka.
<?php
session_start();
$theto = 'toemail'; // change >toemail< to Email address that receives this mail
$theFrom = 'fromemail'; // change >fromemail< to Email address you are sending this Email from
$theSubject = 'Test ' . date("D M j,Y H:i:s T *I*",time());
$theMessage = 'Test from ' . $_SERVER[SCRIPT_URI] . "\r\nServer date and time " . date("D M j,Y H:i:s T *I*",time());
$additional_headers = 'From: ' . $theFrom . "\r\n" . 'Cc: ' . $theFrom . "\r\n" . 'Reply-To: ' . $theFrom . "\r\n";
// 'mail' can return TRUE and your mail still goes into the bit bucket
if (mail ($theto, $theSubject, $theMessage, $additional_headers))
{
// do your thing if 'mail' returns 'TRUE'
print 'Message successfully sent ' . date("D M j,Y H:i:s T *I*",time()) . "<br>\n";
}
else
{
// do your thing if 'mail' returns 'FALSE'
print 'Message delivery failed ' . date("D M j,Y H:i:s T *I*",time()) . "<br>\n";
}
?>