\n'; // header for php mail only $header = ''; // for php mail and wp_mail if (SWEETCF_Options::$form_options['email_reply_to'] != '') { // custom reply_to $header .= "Reply-To: " . SWEETCF_Options::$form_options['email_reply_to'] . "\n"; } else { $header .= "Reply-To: $email\n"; } if ($ctf_email_on_this_domain != '') { $header .= 'X-Sender: ' . $sw_contact_mail_sender . "\n"; $header .= 'Return-Path: ' . $sw_contact_mail_sender . "\n"; } $header .= 'Content-type: text/plain; charset=' . get_option('blog_charset') . $php_eol; @ini_set('sendmail_from', self::$sw_contact_from_email); // Check for safe mode $safe_mode = ((boolean) @ini_get('safe_mode') === false) ? 0 : 1; if (SWEETCF_Options::$form_options['php_mailer_enable'] == 'php') { // sending with php mail $header_php .= $header; // Start output buffering to grab smtp debugging output ob_start(); if ($ctf_email_on_this_domain != '' && !$safe_mode) { // Pass the Return-Path via sendmail's -f command. $result = mail($email, $subject, $message, $header_php, '-f ' . $sw_contact_mail_sender); } else { // the fifth parameter is not allowed in safe mode $result = mail($email, $subject, $message, $header_php); } $smtp_debug = ob_get_clean(); } else if (SWEETCF_Options::$form_options['php_mailer_enable'] == 'wordpress') { // sending with wp_mail add_filter('wp_mail_from', 'SWEETCF_Action::sweetcontact_form_from_email', 1); // took out _form add_filter('wp_mail_from_name', 'SWEETCF_Action::sweetcontact_form_from_name', 1); // took out _form if ($ctf_email_on_this_domain != '') { // Add an action on phpmailer_init to add Sender $this->sw_contact_mail_sender for Return-path in wp_mail // this helps spf checking when the Sender email address matches the site domain name add_action('phpmailer_init', 'SWEETCF_Action::sweetcontact_form_mail_sender', 1); } global $phpmailer; // Make sure the PHPMailer class has been instantiated // (copied verbatim from wp-includes/pluggable.php) // (Re)create it, if it's gone missing if (!is_object($phpmailer) || !is_a($phpmailer, 'PHPMailer')) { require_once ABSPATH . WPINC . '/class-phpmailer.php'; require_once ABSPATH . WPINC . '/class-smtp.php'; $phpmailer = new PHPMailer(); } // Set SMTPDebug to level 2 $phpmailer->SMTPDebug = 2; // Start output buffering to grab smtp debugging output ob_start(); // Send the test mail $result = wp_mail($email, $subject, $message, $header); // Grab the smtp debugging output $smtp_debug = ob_get_clean(); } // Output the response ?>
' . SWEETCF_Options::$form_options['php_mailer_enable']; echo ' ' . $subject; ?>
' . __('See FAQ', 'sweetcontact') . ''; ?> ' . __('See FAQ', 'sweetcontact') . ''; ?> ' . _e('Be sure to check your email to see if you received it.', 'sweetcontact') . ''; echo '' . __('See FAQ', 'sweetcontact') . '
'; } if ($smtp_debug != '') { ?> ' . __('See FAQ', 'sweetcontact') . ''; ?>' . __('Test failed: Invalid email address', 'sweetcontact') . '
'; } ?>