PHP Mailer Error: Mailer Error - must provide at least one recipient email address
14,249
Solution 1
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.
Solution 2
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".
Author by
Tom
Updated on June 05, 2022Comments
-
Tom almost 2 years
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!