johnnys2 Posted August 7, 2013 Share Posted August 7, 2013 Hi Guys, Newbie here, I have a working admin system built and just finishing a few things off. I have a form with a few input fields (make, model, name) and one tick box 'Do you need assistance?'. Once submitted, this form successfully sends the info via email to [email protected]. However, when the tick box mentioned above is ticked, Id like it to ALSO send a different email to [email protected] Code below; if(sendQf22Email($make, $model, $name,)){ $boolMailSent = true; }else{ $boolMailSent = false; } echo "<h1>Request Submitted</h1> <p>Your request has been submitted and is queued for processing.</p> <p>We will contact you once completed.</p> "; Basically the secondary email should go to an 'Assistance' team. However the main email should always go to the Manager. The second email would say something like 'Dear assistance team, please see form below as assistance has been requested......' Is this possible? Apologies if this sounds confusing. And thanks in advance. J Link to comment https://forums.phpfreaks.com/topic/280922-single-form-multiple-emails/ Share on other sites More sharing options...
TOA Posted August 7, 2013 Share Posted August 7, 2013 From the manual [email protected], [email protected] Just add a conditional that only adds it if your box is ticked. *Edit - after reading the whole post again () you'll need to just make a second mail call to use a different message, but the conditional part would remain the same - if it's ticked, run a second call to mail(). Link to comment https://forums.phpfreaks.com/topic/280922-single-form-multiple-emails/#findComment-1443842 Share on other sites More sharing options...
johnnys2 Posted August 7, 2013 Author Share Posted August 7, 2013 thanks for the reply TOA, but would this not just send the exact same email to another recipient? I'd like it to send a different email, to a different recipient. Link to comment https://forums.phpfreaks.com/topic/280922-single-form-multiple-emails/#findComment-1443844 Share on other sites More sharing options...
TOA Posted August 7, 2013 Share Posted August 7, 2013 thanks for the reply TOA, but would this not just send the exact same email to another recipient? I'd like it to send a different email, to a different recipient. Yep, edited my answer as you were typing Link to comment https://forums.phpfreaks.com/topic/280922-single-form-multiple-emails/#findComment-1443845 Share on other sites More sharing options...
johnnys2 Posted August 7, 2013 Author Share Posted August 7, 2013 lol thanks very much, I'll go have a look at conditional mail calls Link to comment https://forums.phpfreaks.com/topic/280922-single-form-multiple-emails/#findComment-1443847 Share on other sites More sharing options...
TOA Posted August 7, 2013 Share Posted August 7, 2013 // here's your normal mail call to manager mail($manager_email, $manager_message); // here's your conditional call if (isset($_POST['checkbox_name'])) { mail($assistance_email, $assistance_message); } You just need to see if the checkbox is checked and if it is send another email. That's what I meant. Sorry, I'm having a hard time being clear today Link to comment https://forums.phpfreaks.com/topic/280922-single-form-multiple-emails/#findComment-1443850 Share on other sites More sharing options...
johnnys2 Posted August 8, 2013 Author Share Posted August 8, 2013 Thanks for this help TOA, how do I check if the checkbox is checked exactly? The code I have now is as follows // conditional call if (isset($_POST["assistance_reqd_for_setup"])) { $mail2($GLOBALS["MyEmail"], $HTMLmessage2); } assistance_reqd_for_setup - is the name of the checkbox MyEmail - is my email address saved in a global config file HTMLmessage2 - is the separate email that I'd like to send Link to comment https://forums.phpfreaks.com/topic/280922-single-form-multiple-emails/#findComment-1443963 Share on other sites More sharing options...
johnnys2 Posted August 8, 2013 Author Share Posted August 8, 2013 sorted! Link to comment https://forums.phpfreaks.com/topic/280922-single-form-multiple-emails/#findComment-1444012 Share on other sites More sharing options...
Recommended Posts
Archived
This topic is now archived and is closed to further replies.