/    Sign up×
Community /Pin to ProfileBookmark

Hi

I’ve set up a contact us form where a user can add their Email address, a subject and a message and used PHPs built in Email capbilities in the below function:

<?php
$to = “[email protected]“;
$subject = $_REQUEST[“subject”];
$body = $_
REQUEST[“message”];
mail($to, $subject, $body)
?>

Problem is when it arrives at the Email address the Email is from [email][email protected][/email] rather than my domain name. Can somebody tell me why this is, and better yet tell me how to fix it so that mail arrives with an address like [email][email protected][/email]

Many thanks in advance

Ross

to post a comment
PHP

5 Comments(s)

Copy linkTweet thisAlerts:
@bokehMar 13.2007 — Before using this do a search for form validation.
Copy linkTweet thisAlerts:
@kcis8rmauthorMar 13.2007 — Thanks, I do validate it before running this section of code, I just cut it out to keep the post to a miniumum! All the values being added to the mail section are what I'd expect. The mail arrives at the destination as expected, it is literally just the address that isn't coming through as expected?!

Could it be something to do with the way the server is set up, or am I missing some headers that would make a difference?
Copy linkTweet thisAlerts:
@jogolMar 13.2007 — $headers = "From: $name <$email>n";
Copy linkTweet thisAlerts:
@bokehMar 13.2007 — Try looking in the manual; as with most of the others, it deals with this function in great detail.[code=php]mail($to, $subject, $body, 'From: [email protected]')[/code]
Copy linkTweet thisAlerts:
@kcis8rmauthorMar 13.2007 — Will do, thanks for the information :-)
×

Success!

Help @kcis8rm spread the word by sharing this article on Twitter...

Tweet This
Sign in
Forgot password?
Sign in with TwitchSign in with GithubCreate Account
about: ({
version: 0.1.9 BETA 5.18,
whats_new: community page,
up_next: more Davinci•003 tasks,
coming_soon: events calendar,
social: @webDeveloperHQ
});

legal: ({
terms: of use,
privacy: policy
});
changelog: (
version: 0.1.9,
notes: added community page

version: 0.1.8,
notes: added Davinci•003

version: 0.1.7,
notes: upvote answers to bounties

version: 0.1.6,
notes: article editor refresh
)...
recent_tips: (
tipper: @AriseFacilitySolutions09,
tipped: article
amount: 1000 SATS,

tipper: @Yussuf4331,
tipped: article
amount: 1000 SATS,

tipper: @darkwebsites540,
tipped: article
amount: 10 SATS,
)...