when my form mails, it show "from: me@localhost", doesn't matter if I say
mail("FROM:me@mymail.co.za", $to, $subject , $message);
or
$to = "info@fullhouse.co.za, $custemail"; $subject = "RoboGuard Order"; $from = "me@mymail.co.za";
Does anyone know why? Peace
First of all check the manual entry for mail() :
bool mail ( string to, string subject, string message [, string additional_headers [, string additional_parameters]] )
The FROM: header goes in the additional_headers section.
I have tried that, but it doesn't work.
$to = "me@mymail.co.za, $custemail"; $subject = "Online order Order"; $message = " Thanks you for your order:\n\n"; $headers = " from: me@mymail.co.za";
mail( $to, $subject , $message , $headers);
Try
$message = " Thanks you for your order:\r\n"; $headers = ' From: me@mymail.co.za'. "\r\n" . 'Reply-To: me@mymail.co.za' . "\r\n" . 'X-Mailer: PHP/' . phpversion();";
many thanks, but something is still not right. I tried it your way, and I tried:
$headers = " From: jo@snow.co.za" "\r\n"; $headers .= " Reply-To: jo@snow.co.za" "\r\n"; $headers .= " X-Mailer: PHP/" phpversion();
Do you think it could be setting on the server?
Is not the same as
$headers = ' From: jo@snow.co.za'. "\r\n"; $headers .= ' Reply-To: jo@snow.co.za'. "\r\n"; $headers .=' X-Mailer: PHP/'. phpversion();
There is a difference in single quotes and double quotes and the reason for the . (dot) which concatenates use what you see above, when you added the"\r\n" to "From: jo@snow.co.za" you confused the PHP parser when it sees an opening string delimiter " in this case it will parse till it sees another one, but when you added the "\r\n" those were not properly parsed.
Are you running this from your local PC? If not you need to run phpinfo() on your server and will probably have to set the sendmail_from() with script on the webserver. To run phpinfo just write <?php echo phpinfo(); ?> save that as phpinfo.php upload it to the root directory of ou server and run it and see what the sendmail from value is in the table of the php install values.
Yo thank you very much man. That's 1 issue resolved. Working perfectly, guess I need to concentrate on that syntax.