I'm experiencing the following problem:
I Have a small form on my site that pointed to a small php processor to send a mail. There "works" but doesnt send a mail. I tested the script in other hosting and works like a charm.
I called the hosting provider to see where is the problem. The hosting company provided the following PHP script to test the mail sending:
<?php
$to = "myemail@myemail.com";
$subject = "Test mail";
$message = "Hello! This is a simple email message.";
$from = "test@pizanoecheverri.co";
$headers = "From:" . $from;
mail($to,$subject,$message,$headers);
echo "Mail Sent.";
?>
Now they told me that I do the required editing so it can works. So I did. I have this small form in the home page (you can see it in pizanoecheveri.co):
<form name="form1" method="post" action="testm/mailing.php" class="miscclass" id="form1">
<div style="text-align: center;" id="contbaloon"><img border="0" alt="" src="/images/misc/baloon1.png"></div>
<input type="text" name="email" class="contactfield" id="textfield">
<p style="text-align: right;"><input type="submit" value="Enviar" name="button" style="background-color: #bbbdc0; border: 0 none; color: #ffffff; margin-bottom: 17px; margin-top: 10px;" class="contacto-x" id="contactbutton"></p>
</form>
And i have done the editings on the code like this:
<?php
$to = "myemail@myemail.com";
$subject = "Lista de correos.";
$message = "El siguiente correo se debe agregar a la lista de correo. ".$_POST["email"];
$from = $_POST["email"];
$headers = "From:" . $from;
mail($to,$subject,$message,$headers);
echo "Mail Sent.";
echo $message;
?>
I noticed this to the hosting provider and they say that is a problem on the programming. This is something i don't know sincei tested the same code in other hosting and works perfectly.
In short i don't understand why the provided code works and when i edit the code doesnt work on THAT HOSTING, when in other it works correctly and there is no syntax error, as far as i see it and Dreamweaver shows it.
The only detail i know from that hosting is that is Windows based running plesk, while the other hosting where i tested the code (where it works) is a Linux based apache. Both are running PHP 5.2.17.
Thanks in Advance
EDIT: i tested the following modification and didn't worked as well on that hosting
<?php
$to = "myemail@myemail.com";
$subject = "Lista de correos.";
$message = "El siguiente correo se debe agregar a la lista de correo. ".$_POST["email"];
$from = $_POST["email"];
#$headers = "From:" . $from;
$headers = 'MIME-Version: 1.0' . "\r\n";
$headers .= 'Content-type: text/html; charset=iso-8859-1' . "\r\n";
$headers .= 'From: ' . $from . "\r\n";
mail($to,$subject,$message,$headers);
echo "Mail Sent.";
echo $message;
?>