@ini_set('sendmail_from', $this->si_contact_from_email);
 if ($si_contact_opt['php_mailer_enable'] == 'php') {
     // autoresponder sending with php
     $header_php .= $header;
     if (!$this->safe_mode) {
         // Pass the Return-Path via sendmail's -f command.
         @mail($email, $subj, $msg, $header_php, '-f ' . $this->si_contact_from_email);
     } else {
         // the fifth parameter is not allowed in safe mode
         @mail($email, $subj, $msg, $header_php);
     }
 } else {
     if ($si_contact_opt['php_mailer_enable'] == 'geekmail') {
         // autoresponder sending with geekmail
         require_once WP_PLUGIN_DIR . '/si-contact-form/ctf_geekMail-1.0.php';
         $ctf_geekMail = new ctf_geekMail();
         if ($si_contact_opt['auto_respond_html'] == 'true') {
             $ctf_geekMail->setMailType('html');
         } else {
             $ctf_geekMail->setMailType('text');
         }
         $ctf_geekMail->_setcharSet(get_option('blog_charset'));
         $ctf_geekMail->_setnewLine($php_eol);
         $ctf_geekMail->return_path($this->si_contact_from_email);
         $ctf_geekMail->x_sender($this->si_contact_from_email);
         $ctf_geekMail->from($this->si_contact_from_email, $this->si_contact_from_name);
         $ctf_geekMail->_replyTo($auto_respond_reply_to);
         $ctf_geekMail->to($email);
         $ctf_geekMail->subject($subj);
         $ctf_geekMail->message($msg);
         @$ctf_geekMail->send();
     $header_php .= $header;
     // Start output buffering to grab smtp debugging output
     ob_start();
     if ($ctf_email_on_this_domain != '' && !$this->safe_mode) {
         // Pass the Return-Path via sendmail's -f command.
         $result = mail($email, $subject, $message, $header_php, '-f ' . $this->si_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 ($si_contact_opt['php_mailer_enable'] == 'geekmail') {
         // sending with geekmail
         require_once WP_PLUGIN_DIR . '/si-contact-form/ctf_geekMail-1.0.php';
         $ctf_geekMail = new ctf_geekMail();
         $ctf_geekMail->setMailType('text');
         $ctf_geekMail->_setcharSet(get_option('blog_charset'));
         $ctf_geekMail->_setnewLine($php_eol);
         if ($ctf_email_on_this_domain != '') {
             $ctf_geekMail->return_path($this->si_contact_mail_sender);
             $ctf_geekMail->x_sender($this->si_contact_mail_sender);
         }
         $ctf_geekMail->from($this->si_contact_from_email, $this->si_contact_from_name);
         $ctf_geekMail->to($email);
         if ($si_contact_opt['email_reply_to'] != '') {
             // custom reply_to
             $ctf_geekMail->_replyTo($si_contact_opt['email_reply_to']);
         } else {
             if ($email != '') {
                 // trying this: keep users reply to even when email_from_enforced
예제 #3
0
 /** 
  * Send a mail for the given form 
  * 
  * This dedicated mail function receives all the required header and content part. 
  * It doesn't use any assumptions from global variable and for that can be called from different locations.
  */
 function si_contact_send_mail($si_contact_opt, $email, $subj, $msg, $from_name, $from_email, $reply_to, $html_mail)
 {
     $safe_mode = (bool) @ini_get('safe_mode') === false ? 0 : 1;
     $php_eol = !defined('PHP_EOL') ? ($eol = strtolower(substr(PHP_OS, 0, 3))) == 'win' ? "\r\n" : ($eol == 'mac' ? "\r" : "\n") : PHP_EOL;
     $php_eol = !$php_eol ? "\n" : $php_eol;
     $msg = wordwrap($msg, 70, $php_eol);
     // Always wrap the mails
     $header_php = '';
     $header = '';
     // prepare the email header
     $header_php = "From: {$from_name} <" . $from_email . ">\n";
     $this->si_contact_from_name = $from_name;
     $this->si_contact_from_email = $from_email;
     $this->si_contact_mail_sender = $from_email;
     $header .= "Reply-To: {$reply_to}\n";
     // for php mail and wp_mail
     $header .= "X-Sender: {$this->si_contact_from_email}\n";
     // for php mail
     $header .= "Return-Path: {$this->si_contact_from_email}\n";
     // for php mail
     if ($html_mail == 'true') {
         $header .= 'Content-Type: text/html; charset=' . get_option('blog_charset') . $php_eol;
     } else {
         $header .= 'Content-Type: text/plain; charset=' . get_option('blog_charset') . $php_eol;
     }
     if (isset($si_contact_opt['email_subject']) && $si_contact_opt['email_subject'] != '') {
         $subj = $si_contact_opt['email_subject'] . " {$subj}";
     }
     @ini_set('sendmail_from', $this->si_contact_from_email);
     if ($si_contact_opt['php_mailer_enable'] == 'php') {
         $header_php .= $header;
         if (!$safe_mode) {
             // Pass the Return-Path via sendmail's -f command.
             @mail($email, $subj, $msg, $header_php, '-f ' . $from_email);
         } else {
             // the fifth parameter is not allowed in safe mode
             @mail($email, $subj, $msg, $header_php);
         }
     } else {
         if ($si_contact_opt['php_mailer_enable'] == 'geekmail') {
             // autoresponder sending with geekmail
             require_once WP_PLUGIN_DIR . '/si-contact-form/ctf_geekMail-1.0.php';
             $ctf_geekMail = new ctf_geekMail();
             if ($html_mail == 'true') {
                 $ctf_geekMail->setMailType('html');
             } else {
                 $ctf_geekMail->setMailType('text');
             }
             $ctf_geekMail->_setcharSet(get_option('blog_charset'));
             $ctf_geekMail->_setnewLine($php_eol);
             $ctf_geekMail->return_path($from_email);
             $ctf_geekMail->x_sender($from_email);
             $ctf_geekMail->from($from_email, $from_name);
             $ctf_geekMail->_replyTo($reply_to);
             $ctf_geekMail->to($email);
             $ctf_geekMail->subject($subj);
             $ctf_geekMail->message($msg);
             @$ctf_geekMail->send();
         } else {
             add_filter('wp_mail_from_name', array(&$this, 'si_contact_form_from_name'), 1);
             add_filter('wp_mail_from', array(&$this, 'si_contact_form_from_email'), 1);
             add_action('phpmailer_init', array(&$this, 'si_contact_form_mail_sender'), 1);
             @wp_mail($email, $subj, $msg, $header);
         }
     }
 }