Click to See Complete Forum and Search --> : Mailer.
DanUK
01-09-2005, 10:52 AM
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.
Removed.
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'] . "\r\n";), 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
DanUK
01-09-2005, 01:09 PM
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,
Hi!
Something like this:mail($to, $subject, $msg, $headers);
if($_POST['CCME']{
mail($_POST['EMAIL'], $subject, $msg, $headers);
}instead of the line you have:mail($to, $subject, $msg, $headers);PJ
DanUK
01-09-2005, 02:27 PM
Thank you VERY much! :)
Originally posted by DanUK
Removed.
Last edited by DanUK on 01-09-2005 at 09:27 PM:confused:
Anyways - you're welcome! PJ :p
DanUK
01-09-2005, 07:01 PM
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:
mail($to, $subject, $msg, $headers);
if($_POST['CCME']{
mail($_POST['EMAIL'], $subject, $msg, $headers);
}
to:
mail($to, $subject, $msg, $headers);
if($_POST['CCME']) {
mail($_POST['EMAIL'], $subject, $msg, $headers);
}
there was a mising ) on line 2.
Apart from that it's working brilliantly.
Thanks again.