Mail Question

I have a question about mail. I used the PHP mail() command and sent an email to my personal account as a test and it comes from:

I want it to come from my domain email:

I did some searching and have not found anything. I am at a loss.

How do I do this?


Did you set all the parameters before using the mail() command?

<?php $Name = "Your Name"; //senders name $email = ""; //senders e-mail adress $recipient = ""; //recipient $mail_body = "The text for the mail..."; //mail body $subject = "Message Subject"; //subject $header = "From: ". $Name . " <" . $email . ">\r\n"; //optional headerfields mail($recipient, $subject, $mail_body, $header); //mail command :) ?>

It’s that last part, the $header, that should fix your return address.


Perfect! Thanks for your quick and accurate response!

I used your syntax and it worked. I had a header but something was wrong with my syntax (not sure what), it showed up in the body.

Thanks again!