exit; } // SET EMAIL ADDRESS TO SEND FORM RESULTS TO $email_to = $ae_email; //$email_to = '*****@*****.**'; if ($email_to == '') { $email_to = '*****@*****.**'; } // SET THE "FROM" FIELD //$email_from = '$_POST['work_email']'; $email_from = '*****@*****.**'; // SET EMAIL SUBJECT LINE $email_subject = "General Contact Message From Website"; // CONSTRUCT EMAIL BODY $email_body = "This is an automatic message" . "\n" . "Someone has submit a message through your contact page.\n" . "\n" . "* * * * * * * * * * * * * * * * * * * * * * * *\n" . "\n"; // CREATE EMAIL BASED ON POST VALUES, EXCEPT FOR THE SPECIFIED FIELDS foreach ($_POST as $key => $value) { if ($key != 'country' && $key != 'time_stamp' && $key != 'max_file_size' && $key != 'submit_x' && $key != 'submit_y') { $email_label = $key; $email_label = str_replace('_', ' ', $email_label); $email_body .= $email_label . ": " . $_POST[$key] . "\n\n"; } } $email_body .= "* * * * * * * * * * * * * * * * * * * * * * * *\n\n\n"; // SEND THE EMAIL TO FORM OWNER $email = new email($email_from, $email_to, $email_subject, $email_body); $email->Attach($_FILES[$fileField]); $email->Send(); // REDIRECT USER TO SUCCESS PAGE header("Location: ../form_results.php?result=success&type=bid"); exit;
/** * Send mail * * @param string $subject * @param string $body * @param string $fromEmail * @param string $toEmail * @param string $ccEmail * @param string $bccEmail * @param string $attachement * @param string $bodyEncoding * @param integer $priority */ function sendMail($subject, $body, $fromEmail, $toEmail, $ccEmail = null, $bccEmail = null, $attachement = null, $bodyEncoding = 'utf-8', $priority = 1) { $oMail = new email(); $oMail->From($fromEmail); $oMail->To($toEmail); if ($ccEmail) { $oMail->Cc($ccEmail); } if ($bccEmail) { $oMail->Bcc($bccEmail); } $oMail->Subject($subject); $oMail->Body($body, $bodyEncoding, "text/html"); $oMail->Priority($priority); if ($attachement) { $oMail->Attach($attachement, "application/x-unknown-content-type", "attachment"); } $oMail->Send(); }