Php mail issue, free account

Hi. I tested a subroutine to send a email, and it worked only once.

I am using a free hosting account, with a parked domain. Will this be a temporary issue, or the free acount have not the php mail functionality?

Thanks in advantage.

Regards!
Pablo

Can you please post the code that you’re using? :slight_smile:

$para = ‘myaccount@gmail.com’ . “;” . $_POST[“email”];
$asunto = ‘Formulario myweb.com.ar’;
$mensaje = "Nombre: " . $_POST[“name”] . “\n” .
"Email: ". $_POST[“email”] . “\n” .
“Teléfono: " . $_POST[“phone”] . “\n” .
“Mensaje: " . $_POST[“message”] . “\n\n\n” .
”¡Recibimos tu mensaje con éxito! Nos comunicaremos con vos en breve. ¡Gracias!”;

$headers = 'From: myaccount@gmail.com' . "\r\n" .
    'Reply-To: myaccount@gmail.com' . "\r\n" .
    'X-Mailer: PHP/' . phpversion();

if (mail($para, $asunto, $mensaje, $headers)) {
	header("Location: http://www.myweb.com.ar/");
	exit();
} else {
	header("Location: http://www.myweb.com.ar/error.html");
	exit();
}

That same piece of code was working (at least, it worked one single time) yesterday. Today, it is not working.

Thanks for your time!!!
Regards,
Pablo

It seems that the script was throwing some errors. I modified the script and this should work. Please copy and paste the script below into the file. :slight_smile:

<?php

$para = 'myaccount@gmail.com\' . \";\" . $_POST[\"email\"];
$asunto = \"Formulario myweb.com.ar\";
$mensaje = \"Nombre: \" . $_POST[\"name\"] . \"\"\n\" .
\"Email: \". $_POST[\"email\"] . \"\n\" .
\"Teléfono: " . $_POST[\"phone\"] . "\n" .
\"Mensaje: " . $_POST["message"] . "\n\n\n"
"¡Recibimos tu mensaje con éxito! Nos comunicaremos con vos en breve. ¡Gracias!"”";

$headers = \'From: myaccount@gmail.com' . "\r\n" .
    'Reply-To: myaccount@gmail.com' . "\r\n" .
    'X-Mailer: PHP/' . phpversion();

if (mail($para, $asunto, $mensaje, $headers)) {
	header("Location: http://www.myweb.com.ar/");
	exit();
} else {
	header("Location: http://www.myweb.com.ar/error.html");
	exit();
}
1 Like

First of all, thanks for your time. But unfortunately, this piece of code is not working. Moreover, I think you missed some concatenation signs (.)

I will reduce this code to the MINIMUM expression to test whether te problem is in the code itself or somewhere else.

I’ll keep you informed.

Regards!
Pablo

I think i found the answer. This might be helpfull for someone else:

I was separating the email addresses with semicolon “;” and i should use comma “,”.

That was all. Thanks for your help, Hexa!

Regards!
Pablo

Sorry I couldn’t be of much help, but glad you got your issue fixed!

Happy Hosting! :tada:

Austin

2 Likes