phpmailer - PHP mailer error: Message body empty -
i had (until yesterday) working form in website. form asks questions , sends customized email depending on answers. working ok, stopped working. here error status:
message not sent.mailer error: message body empty
i´ve changed nothing these months. maybe server upgrade? php version upgrade? wordpress upgrade? find attached php code, maybe find wrong "new standard" or version of php...
require_once("phpmailer/class.phpmailer.php"); // recuperaciĆ³n de las variables del formulario $duracion = $_post['duracion']; $idiomas = $_post['idiomas']; $provincias = $_post['provincias']; $zonas = $_post['zonas']; $nombre = $_post['nombre']; $empresa = $_post['empresa']; $telefono = $_post['telefono']; $email = $_post['email']; $mail = new phpmailer(); $mail->issmtp(); // telling class use smtp $mail->host = "localhost"; // smtp server $mail->smtpauth = true; // enable smtp authentication $mail->username = 'presupuesto@myurl.es'; // smtp username $mail->password = 'freelancer2'; // smtp password $mail->smtpsecure = 'tls'; // enable encryption, 'ssl' accepted $mail->ishtml(true); // set email format html $mail->from = "presupuesto@myurl.es"; $mail->fromname = 'my web'; //mail $contenido = $duracion."\n".$idiomas."\n".$provincias."\n".$zonas."\n".$nombre."\n".$empresa."\n".$telefono."\n".$email; mail("info@myurl.es","solicitud de presupuesto",$contenido,"from:$email"); // resultado en funcion de la puntuaciĆ³n if ($duracion == 1 , $idiomas == 1 , $provincias ==1 , $zonas == 0) { $mensaje = file_get_contents("http://www.myurl.es/presupuesto/2.htm"); $mail->addaddress($email); $mail->subject = "presupuesto del video"; $mail->body = $mensaje; if(!$mail->send()) { echo 'message not sent.'; echo 'mailer error: ' . $mail->errorinfo; die(); } header("location: http://www.myurl.es/gracias"); } elseif ($duracion == 1 , $idiomas == 1 , $provincias ==2 , $zonas == 0) { $mensaje = file_get_contents(" ...and on!
the obvious conclusion content retrieving http://www.myurl.es/presupuesto/2.htm
empty, or has problem. why should check return values.
you're forging address on messages, guarantee delivery failures.
why calling mail()
using phpmailer?
i can see you're using old version of phpmailer, recommend updating.
Comments
Post a Comment