/    Sign up×
Community /Pin to ProfileBookmark

mail function’s emails always going to junk email folder?

When I use mail() to send an email, it always goes to my junk inbox. Is there anything I can do to stop it from being marked as junk mail?

I also have a form where people can send emails to each other. Is there a way I can use “on behalf of” in the mail headers?

For example, the email comes from noreply@mydomain, but the receiver should reply to [email][email protected][/email].

So I would like to have something like;

[QUOTE]

From: [email][email protected][/email] on behalf of [email][email protected][/email]

[/QUOTE]

to post a comment
PHP

4 Comments(s)

Copy linkTweet thisAlerts:
@NogDogFeb 15.2009 — As far as junk mail issues, search this forum and the web, as it has been discussed many, many times.

As far as the reply issue, add a "Reply-To:" header to the additional headers parameter.
Copy linkTweet thisAlerts:
@TopkatauthorFeb 15.2009 — Hi NogDog,

I tried this, but it didn't work, the from email came from [email][email protected][/email] and I could only reply to [email][email protected][/email]. $from_email is not [email][email protected][/email] :-))

mail($to_email, "Subject", $body, "From: [email][email protected][/email]" . "rn" . "Reply-To:" . $from_email);[/QUOTE]

Any idea of what I'm doing wrong?
Copy linkTweet thisAlerts:
@NogDogFeb 15.2009 — I do not see anything obviously wrong, though I always have a space after the colons of the various headers. I suppose it might be a good idea to throw in some debug code to verify that $from_email is actually set with the expected value just before you use it.
Copy linkTweet thisAlerts:
@TopkatauthorFeb 15.2009 — I made a silly mistake, I expected it to say in the email;

From [email][email protected][/email] on behalf of [email][email protected][/email][/QUOTE]

I hit reply and "[email protected]" went into the "to:" textbox. So it works fine! :-))

Thanks NogDog! :-))
×

Success!

Help @Topkat 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.5,
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: @Yussuf4331,
tipped: article
amount: 1000 SATS,

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

tipper: @Samric24,
tipped: article
amount: 1000 SATS,
)...