Tom
Tom

Reputation: 143

PHP Mailer Error: Mailer Error - must provide at least one recipient email address

I'm having and an issue with php mailer script. Using mamp the script works, but on the server I get an error (I've omitted sensitive info).

"Invalid address: [valid email] Mailer Error: You must provide at least one recipient email address."

Heres my code:

require_once("includes/phpmailer/class.phpmailer.php");

    $mail = new PHPMailer();
    $mail->IsSMTP();

    $mail->SMTPAuth   = true;                  
    $mail->Host       = "smtp.emailsrvr.com"; 
    $mail->SMTPDebug  = 2;                    
    $mail->Port       = 25;                    
    $mail->Username   = "[email protected]"; 
    $mail->Password   = "test";

    $mail->Subject = "Subject";

    $mail->SetFrom($_POST['email'], $_POST['name']);
    $mail->AddReplyTo($_POST['email'], $_POST['name']);

    $address = "[email protected]";
    $mail->AddAddress($address, "name");

    $body = "<p>test</p>";

    $mail->MsgHTML($body);


    if(!$mail->Send()) {
      echo "Mailer Error: " . $mail->ErrorInfo;
    } else {
      echo "Message sent!";
    }

If it helps, I am using the rackspace email apps.

Im not very savy with php or server setups unfortunately so if anyone can help that would be great!

Upvotes: 3

Views: 14958

Answers (3)

Vivek
Vivek

Reputation: 1493

I face this issue when my class name and my function name is same. Than i change the name of the function and it was resolved. Hope it will help anyone.

Upvotes: 0

Tom
Tom

Reputation: 143

So i had no luck here, but I now know the issue stems from server mail settings rather then the script.

In the end I just went to using postmark.

Upvotes: 0

Fernando Cordeiro
Fernando Cordeiro

Reputation: 403

Just change this line:

$address = "[valid email]";

to something like:

$address = "[email protected]";

or to your own email, so you can test better, and it will work.

It's just stating that '[valid email]' is not actually a "valid email".

Upvotes: 2

Related Questions