//where we would like to send email $recipientEmail = '*****@*****.**'; $recipientName = 'Recipient Name'; //Address which will be visible in "From" field $fromEmail = '*****@*****.**'; $fromName = 'Site Admnistrator'; //Validation error messages $requiredMessage = 'Field is required'; $invalidEmail = 'Invalid email'; /** * Advanced configuration - no need to modify */ require_once dirname(__FILE__) . '/vendor/ctPHPMailer.php'; $mail = new ctPHPMailer(); //set your email address $mail->AddAddress($recipientEmail, $recipientName); $mail->SetFrom($fromEmail, $fromName); $debug = false; //if problems occur, set to true to view debug messages /** * For GMAIL configuration please use this values: * * $mail->Host = "smtp.gmail.com"; // SMTP server * $mail->Username = "******"; // SMTP account username * $mail->Password = "******"; // SMTP account password * $mail->Port = 465; // set the SMTP port for the GMAIL server * $mail->SMTPSecure = "ssl"; * * More configuration options available here: https://code.google.com/a/apache-extras.org/p/phpmailer/wiki/ExamplesPage */ /**
// enable SMTP authentication - true if username and password required $mail->Port = 587; // set the SMTP port (usually 587, or 465 when SSL) $mail->IsSMTP(); $mail->SMTPDebug = $debug ? 2 : 0; // debug messages - set debug to false on production! /** * Config for simple mail() function * Just delete whole section (or just line $mail->IsSMTP();) "SMTP" above and mail will use default mail() function */ /** * MAIL CONFIG */ $mail->SetFrom('*****@*****.**', 'First Last'); //from address $mail->AddAddress("*****@*****.**", "Sender Name"); //where to send email $mail->Subject = "Contact Form"; //setup proper validation errors. If you change required=false, please make //sure your contact form does not have "required" tag in input fields //also keys of array (name, message, email) are the names used in contact form $formFields = array('name' => array('required' => true, 'required_error' => "Field is required"), 'message' => array('required' => true, 'required_error' => "Field is required"), 'email' => array('required' => true, 'required_error' => "Field is required", 'email_error' => "Email invalid")); $errorMessage = "Unfortunately we couldn't deliver your message. Please try again later."; $successMessage = "Thank you. We will contact you shortly."; //NO NEED TO EDIT ANYTHING BELOW //let's validate and return errors if required if ($errors = $mail->validate($formFields, $_POST)) { echo json_encode(array('errors' => $errors)); exit; } $mail->setup(dirname(__FILE__) . '/mail.html', $_POST, $formFields);
More configuration options available here: https://code.google.com/a/apache-extras.org/p/phpmailer/wiki/ExamplesPage */ /** * SERVER CONFIG */ /** * Config for SMTP */ $mail->Host = "mail.yourdomain.com."; // sets the SMTP server $mail->Username = "******"; // SMTP account username $mail->Password = "******"; // SMTP account password $mail->SMTPAuth = true; // enable SMTP authentication - true if username and password required $mail->Port = 587; // set the SMTP port (usually 587, or 465 when SSL) $mail->IsSMTP(); $mail->SMTPDebug = $debug ? 2 : 0; // debug messages - set debug to false on production! /** * Config for simple mail() function * Just delete whole section (or just line $mail->IsSMTP();) "SMTP" above and mail will use default mail() function */ //to send mail from contact form or book a table table to a different email just copy those two lines and paste below //require_once "config.php" in send.php or table.php $mail->SetFrom('*****@*****.**', 'First Last'); //from address $mail->AddAddress("*****@*****.**", "Recipient Name"); //where to send email