/    Sign up×
Community /Pin to ProfileBookmark

Hello.

Okay I’m kind of stumped on this.

Below is a copy of our mailer which validates submissions, generates a unique ID, sends the mail and then echos a thank you message, their ID and a copy of the submission.

However, what I’d like to achieve is that on the forms I could have a checkbox, let’s call it “CCME” which would allow the person to select “Please send me a copy of this submission”.

Then, if all validates is complete and so forth a copy of the e-mail is sent to the e-mail address.
Is this easy to achieve?

Thanks.

[code=php]
Removed.
[/code]

to post a comment
PHP

6 Comments(s)

Copy linkTweet thisAlerts:
@pj59Jan 09.2005 — Hello!

Below the line to send the mail:

mail($to, $subject, $msg, $headers);

put an if statement (don't know the name of your checkbox etc., so I leave that out), which, if the checkbox is checked, would execute another mail():

mail($_POST['EMAIL'], $subject, $msg, $headers);

That should do the job because you are referring to "$_POST['EMAIL']" in your headers ($headers .= "Reply-To: " . $_POST['EMAIL'] . "rn"?, so I assume, that is the senders address. You should maybe modify the subject or the message in that line indicating something like 'Copy for you blah blah'.

Regards PJ
Copy linkTweet thisAlerts:
@DanUKauthorJan 09.2005 — Hi,

Thanks for your reply.

Not sure I follow, sorry.

Would I need another mail function, or would I use the same one?

The checkbox would be called "CCME".

Regards,
Copy linkTweet thisAlerts:
@pj59Jan 09.2005 — Hi!

Something like this:[code=php]mail($to, $subject, $msg, $headers);
if($_POST['CCME']{
mail($_POST['EMAIL'], $subject, $msg, $headers);
}[/code]
instead of the line you have:[code=php]mail($to, $subject, $msg, $headers);[/code]PJ
Copy linkTweet thisAlerts:
@DanUKauthorJan 09.2005 — Thank you VERY much! ?
Copy linkTweet thisAlerts:
@pj59Jan 09.2005 — [i]Originally posted by DanUK [/i]

[B][code=php]
Removed.
[/code]
[/B][I]Last edited by DanUK on 01-09-2005 at 09:27 PM[/I][/QUOTE]
?

Anyways - you're welcome! PJ :p
Copy linkTweet thisAlerts:
@DanUKauthorJan 10.2005 — Hiya.

Yep, I removed the original code from the first post because it was a hefty piece of code so little point of it remaining there when the topic is solved.

I had change:
[code=php]
mail($to, $subject, $msg, $headers);
if($_POST['CCME']{
mail($_POST['EMAIL'], $subject, $msg, $headers);
}
[/code]


to:

[code=php]
mail($to, $subject, $msg, $headers);
if($_POST['CCME']) {
mail($_POST['EMAIL'], $subject, $msg, $headers);
}
[/code]


there was a mising ) on line 2.

Apart from that it's working brilliantly.

Thanks again.
×

Success!

Help @DanUK 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 6.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: @nearjob,
tipped: article
amount: 1000 SATS,

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

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