• Status: Solved
  • Priority: Medium
  • Security: Public
  • Views: 185
  • Last Modified:

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

0
james130c
Asked:
james130c
  • 2
  • 2
1 Solution
 
hieloCommented:
The fourth argument should be the header.
Try this:
$success = mail($EmailFrom, $Subject, $Body . "\n\n" . $body_text, "From: MyEmailAddress@domain.com");
0
 
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

Featured Post

Free Tool: Subnet Calculator

The subnet calculator helps you design networks by taking an IP address and network mask and returning information such as network, broadcast address, and host range.

One of a set of tools we're offering as a way of saying thank you for being a part of the community.

  • 2
  • 2
Tackle projects and never again get stuck behind a technical roadblock.
Join Now