I have the following code to send my emails:
$EmailFrom= "staff@homes.com";
$EmailTo = "alejo@yahoo.com, hunterno1@gmail.com";
$Subject = "Contact The Loft";
$success = mail($EmailTo, $Subject, $Body, $EmailFrom);
When I submit my form it sends the mail correctly but on my email the header is not displayed correctly. Look the following image:
I do not want THEHNOGK@SERVER179.WEB-HOSTING.COM be displayed as the header, so that is why i search thru google and i found out that i need to customize my header. So i did the follow, but now the email is not sent. it seems there is something wrong with the headers:
<?php
$EmailFrom= "From: HudsonLofts <staff@hobokenhomes.com>\r\n";
$EmailFrom.= "X-Mailer: PHP/" . phpversion()."\r\n";
$EmailFrom.= "MIME-Version: 1.0" . "\r\n";
$EmailFrom.= "Content-type: text/html; charset=iso-8859-1 \r\n";
$EmailTo = "alejo.ferguson@yahoo.com, hunternova01@gmail.com";
$Subject = "Contact The Hudson Loft";
And this is where i call the mail function:
$success = mail($EmailTo, $Subject, $Body, $EmailFrom);
When i submit the form and check my email account not email is received.
I will appreciate your help. Thanks in advance
I have realized that when i use FROM: the mail is not sent. Moreover the mail function does not work it returns false. BUT it i remove FROM and just use: HudsonLofts then it works but the headers it is not displayed properly on my email :(