Using a php web form to send data to the user who filled it out, problems.

Hi, i have a web form that works and everything, but the input entered by the user is sent to their email address to confirm what they have entered. This is all fine, but they are having problems finding this email as it comes from 'root@gamma.control-access12.com ' which i believe is the server default for my hosting account. How can i have it say the email is from for example (myemailaddress).
$success = mail($EmailFrom, $Subject, $Body, $body_text, "From: MyEmailAddress@domain.com");
 
( i have tried using my e-mail address in the From: bit... no luck still displays the above root@gamma.control-access12.com)
 
How can i get around this problem? other than that all is fine, but nobody can ever find the mail as who would want junk mail from root@gamma, ect...

Open in new window

LVL 1
james130cAsked:
Who is Participating?
I wear a lot of hats...

"The solutions and answers provided on Experts Exchange have been extremely helpful to me over the last few years. I wear a lot of hats - Developer, Database Administrator, Help Desk, etc., so I know a lot of things but not a lot about one thing. Experts Exchange gives me answers from people who do know a lot about one thing, in a easy to use platform." -Todd S.

hieloCommented:
The fourth argument should be the header.
Try this:
$success = mail($EmailFrom, $Subject, $Body . "\n\n" . $body_text, "From: MyEmailAddress@domain.com");
0

Experts Exchange Solution brought to you by

Your issues matter to us.

Facing a tech roadblock? Get the help and guidance you need from experienced professionals who care. Ask your question anytime, anywhere, with no hassle.

Start your 7-day free trial
james130cAuthor Commented:
Thank that has worked great! Could you explain to me by fourth argument what you meant? how did you work out why it was wrong? Just want to understand the code a bit more as to why mine wasn't working.

Thanks.
0
hieloCommented:
mail() takes at most 4 arguments. You were passing 5. The fourth argument is supposed to be headers. Since mail takes at most 4 arguments and the 4th argument is supposed to be the headers, you were correct in supplying the headers in the last argument. Your mistake was really passing 5 instead of 4 arguments. I "joined" your original third and fourth arguments with newlines spacers.
0
james130cAuthor Commented:
ok thanks for clearing that up, superb.
0
It's more than this solution.Get answers and train to solve all your tech problems - anytime, anywhere.Try it for free Edge Out The Competitionfor your dream job with proven skills and certifications.Get started today Stand Outas the employee with proven skills.Start learning today for free Move Your Career Forwardwith certification training in the latest technologies.Start your trial today
PHP

From novice to tech pro — start learning today.