Jump to content

johnnys2

Members
  • Posts

    13
  • Joined

  • Last visited

johnnys2's Achievements

Newbie

Newbie (1/5)

0

Reputation

  1. thanks very much micah1701 - that worked! Not until I changed that to require_once() as you advised. Just one more thing now, the two emails send perfectly like I was hoping, however the second email (to Support) sends whether or not the tick box is checked or not? Has it got anything to do with the code below - should I have this somewhere? if(isset($_POST['assistance_reqd_for_setup'])&&$_POST['assistance_reqd_for_setup']==1){ $mail->AddAddress("Support@something.com"); $mail->Subject = "Form Submission - Request - Setup"; $mail->Body = $HTMLmessage2; } Again, thanks v much
  2. thanks for this help - ill go give it a try now
  3. Hi Guys, I hope somebody can help me out. I've tried to figure this out by myself the past few weeks, but can't! Newbie to php, taking over project from somebody else. I have an online form that users fill in, this info is sent via email to myself successfully (Admin). I would like instead to send multiple emails - one to Admin saying 'User xyz has filled out the form below' AND one sent to the User saying 'Thank you for filling out the form below' AND one sent to Support saying 'User xyz has requested for support please see below' So three different email bodys and three different recipients. All I have currently is a common.php page with two functions (one for each email form I presume), and a form.php page with the actual html form (and some php code). First function in common.php function sendEmailToAdmin($make, $model, $isSetupHelpReqd){ $isSetupHelpReqd = (isset($isSetupHelpReqd) && $isSetupHelpReqd =='1') ? 'yes' : 'no'; $HTMLmessage1 = "<font color=#4284B0 face=Arial size=4><strong>".$GLOBALS["app-name"]."</strong></font><br /> \n <p>Admin, please see the form below.</p> <table> <tbody> <tr> <td>Make:</td> <td>".$make."</td> </tr> <tr> <td>Model:</td> <td>".$model."</td> </tr> <tr> <td>Setup Request:</td> <td>".$isSetupHelpReqd."</td> </tr> </tbody> </table> <hr />".$GLOBALS["appurl"]." "; require("scripts/phpmailer/class.phpmailer.php"); $mail = new PHPMailer(); $mail->IsSMTP(); $mail->Host = $GLOBALS["smtp_server"]; $mail->SMTPAuth = false; $mail->IsHTML(true); $mail->From = $GLOBALS["emailsenderaddress"]; $mail->FromName = $GLOBALS["emailsendername"]; $mail->Body = $HTMLmessage1; $mail->AltBody = "This email is in HTML format please view in HTML mode"; $mail->Subject = "Form Submission - Request"; $mail->AddAddress("admin@something.com"); // this sends the email to Net Services if(!$mail->Send()){ return false; }else{ return true; } } // end sendEmailToAdmin Function Second function in commpn.php function sendEmailToSupport($make, $model, $isSetupHelpReqd){ $isSetupHelpReqd = (isset($isSetupHelpReqd) && $isSetupHelpReqd =='1') ? 'yes' : 'no'; $HTMLmessage2 = "<font color=#4284B0 face=Arial size=4><strong>".$GLOBALS["app-name"]."</strong></font><br /> \n <p>Support has been requested, please see the form below.</p> <table> <tbody> <tr> <td>Make:</td> <td>".$make."</td> </tr> <tr> <td>Model:</td> <td>".$model."</td> </tr> <tr> <td>Setup Request:</td> <td>".$isSetupHelpReqd."</td> </tr> </tbody> </table> <hr />".$GLOBALS["appurl"]." "; require("scripts/phpmailer/class.phpmailer.php"); $mail = new PHPMailer(); $mail->IsSMTP(); $mail->Host = $GLOBALS["smtp_server"]; $mail->SMTPAuth = false; $mail->IsHTML(true); $mail->From = $GLOBALS["emailsenderaddress"]; $mail->FromName = $GLOBALS["emailsendername"]; $mail->Body = $HTMLmessage2; $mail->AltBody = "This email is in HTML format please view in HTML mode"; $mail->Subject = "Request Completed - Assistance Requested"; $mail->AddAddress("support@something.com"); if(!$mail->Send()){ return false; }else{ return true; } } // end sendEmailToSupport Function I also found this code in the second function commented out, but it never did anything //send copy of form to Support if Setup box is ticked if(isset($_POST['assistance_reqd_for_setup'])&&$_POST['assistance_reqd_for_setup']==1){ $mail->AddAddress("Support@something.com"); $mail->Subject = "Form Submission - Request - Setup"; $mail->Body = $HTMLmessage2; } //end send mail to Support This is the code after my insert query on the form.php page if(sendEmailToAdmin($make, $model,$isSetupHelpReqd)){ $boolMailSent = true; }else{ $boolMailSent = false; } Any guidance or help at all would be much appreciated, apologies for my lack of knowledge and ignorance however I have tried to fix this myself. I've looked at switch statements, if else loops, clearaddress() to send to multiple recipients amongst others. Thanks in advance, J
  4. 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
  5. lol thanks very much, I'll go have a look at conditional mail calls
  6. 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.
  7. 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 manager@something.com. However, when the tick box mentioned above is ticked, Id like it to ALSO send a different email to assistance@something.com 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
  8. thanks for the tips guys! OK now I have the code below; <td>Date of Request</td> <td>{$result[date("d-F-Y H:i:s", strtotime($result['cdate']))]}</td> <td>Date Last Modified</td> <td>{$result['mdate']}</td> The first row cdate (date of request) doesn't output any date at all now The second row mdate (date last modified) outputs 2013-07-30 11:55:00 Maybe I need to go away and start at the beginning with PHP!
  9. apologies, I will try to clarify In one of my other php pages I have the code below <td> '.date("d-M-Y H:i:s", strtotime($result['cdate'])).' </td> This successfully outputs this text 30-Jul-2013 11:55:00 Is it possible to implement such code into the code below (without having to change querys etc) <td>{$result['cdate']}</td> <td>{$result['mdate']}</td> This is a project I am taking over from another person, and just needs fine tuned to be completed. Thanks again for the help. If I'm making no sense let me know! J
  10. thanks for the help is there no way of adding something like 'd-m-y' amongst the <td>{$result['mdate']}</td> - excuse my ignorance!
  11. Hi Guys, Just looking for some quick advice on code - newbie here My code is as follows <td>{$result['cdate']}</td> <td>{$result['mdate']}</td> This successfully outputs my date in the format 2013-05-08 12:24:04 - however I would like it as 08 July 2013 12:24:04 The cdate is a datetime and mdate is a timestamp in mysql database. I have been reading about srttotime and can't get my head around it, any help is appreciated. Thanks in advance, J
×
×
  • Create New...

Important Information

We have placed cookies on your device to help make this website better. You can adjust your cookie settings, otherwise we'll assume you're okay to continue.