Search code examples
phpemailsendmail

[email protected] not working (rackspace)


I'm trying to use noreply to send out emails, but it doesn't work - it wont sent anything. I am using this test-file:

<?php
$to      = 'myemailhere';
$subject = 'You received an email message!';
$message = 'This is a message in the email body form.';
$headers = 'From: [email protected]' . "\r\n" .
    'Reply-To: [email protected]' . "\r\n" .
    'X-Mailer: PHP/' . phpversion();

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

What could be the problem? By the way, I am using rackspacke, if anyone should know about it.

Thanks in advance!


Solution

  • If you're running on a Rackspace cloud server, you will have to configure the server yourself to be able to send mail. The mail() function relies on the OS configuration to handle emailing. If you are on a Rackspace cloud site, you will likely need to contact Rackspace support for help.

    Personally I dodge this bullet altogether by using PEAR's SMTP class. This is a full SMTP implementation in PHP and since it does not rely on any outside configuration or module, it is fully portable. It has saved me a LOT of trouble.

    http://pear.php.net/package/Mail

    http://pear.php.net/package/Net_SMTP

    Note: The PEAR site is having some loading issues atm for me. Give it a minute and it should load.