/    Sign up×
Community /Pin to ProfileBookmark

form mail BCC

How could I setup so when my form contents are amiled to the correct person it also mails a BCC back to me, so I retain a copy?

to post a comment
PHP

1 Comments(s)

Copy linkTweet thisAlerts:
@ShrineDesignsMay 05.2004 — send the same email to yourself in the same instance<?php
if($_POST)
{
$to = $_POST['to'];
// must strip any newlines and carrage returns from
// the suject otherwise, mail() will fail
$subject = str_replace("n", " ", $_POST['subject']);
$subject = str_replace("r", " ", $_POST['subject']);
$message = htmlspecialchars($_POST['message'], ENT_COMPAT);
$mail_to_you = mail($to, $subject, $message);
$mail_to_me = mail('[email protected]', $subject, $message);

<i> </i>if($mail_to_you !== false &amp;&amp; $mail_to_me !== false)
<i> </i>{
<i> </i> echo "mail sent.";
<i> </i>}
<i> </i>else
<i> </i>{
<i> </i> echo "error, unable to send mail!";
<i> </i>}
}
?&gt;
×

Success!

Help @mikeyzc 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,
)...