Aan Aan - 2 years ago 415
PHP Question

PHP Mailer Class issue :Message body empty

When i try to send email using PHPMailer class I get this error :
Mailer Error: Message body empty :



$mail = new PHPMailer();

$mail->SMTPAuth = true;

$mail->SMTPSecure = "ssl";
$mail->Host = "rsb20.rhostbh.com";
$mail->Port = 465;
$mail->Username = "jobserreker+furrtexlab.com";
$mail->Password = "12345678a";

$mail->From = "jobserreker@furrtexlab.com";
$mail->FromName = "Job Seeker";
$mail->Subject = $_GET['subject'];

$mail->AddAddress($_GET['to'],"name to");

echo "Mailer Error: " . $mail->ErrorInfo;


echo "Message sent!";

Answer Source

As Gerald Versluis said, since you're setting IsHTML() to false, you'll have to use the ->Body property to set the actual body of the mail.

$mail->Body = $_GET['msg'];

You should also use POST instead of GET for submitting something which causes an action to be performed.

Recommended from our users: Dynamic Network Monitoring from WhatsUp Gold from IPSwitch. Free Download