|
From: FlorinCB <ory...@us...> - 2010-01-06 19:40:57
|
Update of /cvsroot/mxbb/core/includes/shared/phpbb2/includes In directory sfp-cvsdas-1.v30.ch3.sourceforge.com:/tmp/cvs-serv16897/shared/phpbb2/includes Modified Files: emailer.php smtp.php Log Message: upd Index: emailer.php =================================================================== RCS file: /cvsroot/mxbb/core/includes/shared/phpbb2/includes/emailer.php,v retrieving revision 1.5 retrieving revision 1.6 diff -C2 -d -r1.5 -r1.6 *** emailer.php 7 Oct 2008 00:10:14 -0000 1.5 --- emailer.php 6 Jan 2010 19:40:39 -0000 1.6 *************** *** 19,30 **** * ***************************************************************************/ - - - /** - * Modifications: - * Added $emailer->use_html method by OryNider - * - */ - // --- 19,22 ---- *************** *** 88,91 **** --- 80,89 ---- $this->subject = trim(preg_replace('#[\n\r]+#s', '', $subject)); } + + // set up skip mail + function email_skip($email_skip = false) + { + $this->email_skip = $email_skip; + } // set up extra mail headers *************** *** 110,114 **** function use_template($template_file, $template_lang = '') { ! global $board_config, $phpbb_root_path, $mx_root_path, $mx_root_path; if (trim($template_file) == '') --- 108,112 ---- function use_template($template_file, $template_lang = '') { ! global $board_config, $phpbb_root_path, $module_root_path, $mx_root_path; if (trim($template_file) == '') *************** *** 141,150 **** } ! $this->tpl_msg[$template_lang . $template_file] = fread($fd, filesize($tpl_file)); fclose($fd); } $this->msg = $this->tpl_msg[$template_lang . $template_file]; ! return true; } --- 139,148 ---- } ! $this->tpl_msg[$template_lang . $template_file] = @fread($fd, filesize($tpl_file)); fclose($fd); } $this->msg = $this->tpl_msg[$template_lang . $template_file]; ! return true; } *************** *** 211,226 **** $to = $this->addresses['to']; - $cc = (count($this->addresses['cc'])) ? implode(', ', $this->addresses['cc']) : ''; $bcc = (count($this->addresses['bcc'])) ? implode(', ', $this->addresses['bcc']) : ''; // Build header if ($this->use_html) { ! $this->extra_headers = (($this->reply_to != '') ? "Reply-to: $this->reply_to\n" : '') . (($this->from != '') ? "From: $this->from\n" : "From: " . $board_config['board_email'] . "\n") . "Return-Path: " . $board_config['board_email'] . "\nMessage-ID: <" . md5(uniqid(time())) . "@" . $board_config['server_name'] . ">\nMIME-Version: 1.0\nContent-type: text/html; charset=" . $this->encoding . "\nContent-transfer-encoding: 8bit\nDate: " . date('r', time()) . "\nX-Priority: 3\nX-MSMail-Priority: Normal\nX-Mailer: PHP\nX-MimeOLE: Produced By Mx-Publisher\n" . $this->extra_headers . (($cc != '') ? "Cc: $cc\n" : '') . (($bcc != '') ? "Bcc: $bcc\n" : ''); } else { ! $this->extra_headers = (($this->reply_to != '') ? "Reply-to: $this->reply_to\n" : '') . (($this->from != '') ? "From: $this->from\n" : "From: " . $board_config['board_email'] . "\n") . "Return-Path: " . $board_config['board_email'] . "\nMessage-ID: <" . md5(uniqid(time())) . "@" . $board_config['server_name'] . ">\nMIME-Version: 1.0\nContent-type: text/plain; charset=" . $this->encoding . "\nContent-transfer-encoding: 8bit\nDate: " . date('r', time()) . "\nX-Priority: 3\nX-MSMail-Priority: Normal\nX-Mailer: PHP\nX-MimeOLE: Produced By Mx-Publisher\n" . $this->extra_headers . (($cc != '') ? "Cc: $cc\n" : '') . (($bcc != '') ? "Bcc: $bcc\n" : ''); } --- 209,224 ---- $to = $this->addresses['to']; $cc = (count($this->addresses['cc'])) ? implode(', ', $this->addresses['cc']) : ''; $bcc = (count($this->addresses['bcc'])) ? implode(', ', $this->addresses['bcc']) : ''; + $skip = ($this->email_skip == $this->addresses['to']) ? true : false; // Build header if ($this->use_html) { ! $this->extra_headers = (($this->reply_to != '') ? "Reply-to: $this->reply_to\n" : '') . (($this->from != '') ? "From: $this->from\n" : "From: " . $board_config['board_email'] . "\n") . "Return-Path: " . $board_config['board_email'] . "\n" . "Message-ID: <" . md5(uniqid(time())) . "@" . $board_config['server_name'] . ">\nMIME-Version: 1.0\nContent-type: text/html; charset=" . $this->encoding . "\n" . "Content-transfer-encoding: 8bit\nDate: " . date('r', time()) . "\n" . "X-Priority: 3\n" . "X-MSMail-Priority: Normal\n" . "X-Mailer: PHP\nX-MimeOLE: Produced By MXP\n" . $this->extra_headers . (($cc != '') ? "Cc: $cc\n" : '') . (($bcc != '') ? "Bcc: $bcc\n" : ''); } else { ! $this->extra_headers = (($this->reply_to != '') ? "Reply-to: $this->reply_to\n" : '') . (($this->from != '') ? "From: $this->from\n" : "From: " . $board_config['board_email'] . "\n") . "Return-Path: " . $board_config['board_email'] . "\n" ."Message-ID: <" . md5(uniqid(time())) . "@" . $board_config['server_name'] . ">\nMIME-Version: 1.0\nContent-type: text/plain; charset=" . $this->encoding . "\n" . "Content-transfer-encoding: 8bit\nDate: " . date('r', time()) . "\n". "X-Priority: 3\n" . "X-MSMail-Priority: Normal\n" . "X-Mailer: PHP\nX-MimeOLE: Produced By Mx-Publisher\n" . $this->extra_headers . (($cc != '') ? "Cc: $cc\n" : '') . (($bcc != '') ? "Bcc: $bcc\n" : ''); } *************** *** 228,237 **** if ( $this->use_smtp ) { ! if (!defined('SMTP_INCLUDED')) ! { ! include($mx_root_path . 'includes/shared/phpbb2/includes/smtp.' . $phpEx); } ! $result = smtpmail($to, $this->subject, $this->msg, $this->extra_headers); } else --- 226,235 ---- if ( $this->use_smtp ) { ! if ( !defined('SMTP_INCLUDED') ) ! { ! include($mx_root_path . 'includes/contact_smtp.' . $phpEx); } ! $result = ($skip) ? false : smtpmail($to, $this->subject, $this->msg, $this->extra_headers); } else *************** *** 240,244 **** $to = ($to == '') ? (($board_config['sendmail_fix']) ? ' ' : 'Undisclosed-recipients:;') : $to; ! $result = mail($to, $this->subject, preg_replace("#(?<!\r)\n#s", "\n", $this->msg), $this->extra_headers); if (!$result && !$board_config['sendmail_fix'] && $empty_to_header) --- 238,242 ---- $to = ($to == '') ? (($board_config['sendmail_fix']) ? ' ' : 'Undisclosed-recipients:;') : $to; ! $result = ($skip) ? false : mail($to, $this->subject, preg_replace("#(?<!\r)\n#s", "\n", $this->msg), $this->extra_headers); if (!$result && !$board_config['sendmail_fix'] && $empty_to_header) *************** *** 270,282 **** $board_config['sendmail_fix'] = 1; ! $result = mail($to, $this->subject, preg_replace("#(?<!\r)\n#s", "\n", $this->msg), $this->extra_headers); } } // Did it work? ! if (!$result) { mx_message_die(GENERAL_ERROR, 'Failed sending email :: ' . (($this->use_smtp) ? 'SMTP' : 'PHP') . ' :: ' . $result, '', __LINE__, __FILE__); } return true; --- 268,285 ---- $board_config['sendmail_fix'] = 1; ! $result = ($skip) ? false : mail($to, $this->subject, preg_replace("#(?<!\r)\n#s", "\n", $this->msg), $this->extra_headers); } } // Did it work? ! if ((!$result) && (!$skip)) { mx_message_die(GENERAL_ERROR, 'Failed sending email :: ' . (($this->use_smtp) ? 'SMTP' : 'PHP') . ' :: ' . $result, '', __LINE__, __FILE__); } + + if (!$skip) + { + //print('Failed sending email :: Use another adress for sender.', __LINE__, __FILE__); + } return true; Index: smtp.php =================================================================== RCS file: /cvsroot/mxbb/core/includes/shared/phpbb2/includes/smtp.php,v retrieving revision 1.1 retrieving revision 1.2 diff -C2 -d -r1.1 -r1.2 *** smtp.php 9 Sep 2007 16:51:51 -0000 1.1 --- smtp.php 6 Jan 2010 19:40:39 -0000 1.2 *************** *** 22,25 **** --- 22,35 ---- define('SMTP_INCLUDED', 1); + /** + * Send command to smtp server + */ + function server_send($command, $private_info = false) + { + fputs($socket, $command . "\r\n"); + + // We could put additional code here + } + // // This function has been modified as provided *************** *** 105,112 **** mx_message_die(GENERAL_ERROR, "Email message was blank", "", __LINE__, __FILE__); } // Ok we have error checked as much as we can to this point let's get on // it already. ! if( !$socket = @fsockopen($board_config['smtp_host'], 25, $errno, $errstr, 20) ) { mx_message_die(GENERAL_ERROR, "Could not connect to smtp host : $errno : $errstr", "", __LINE__, __FILE__); --- 115,124 ---- mx_message_die(GENERAL_ERROR, "Email message was blank", "", __LINE__, __FILE__); } + + $board_config['smtp_port'] = ($board_config['smtp_port']) ? $board_config['smtp_port'] : $contact_config['smtp_port']; // Ok we have error checked as much as we can to this point let's get on // it already. ! if( !$socket = @fsockopen($board_config['smtp_host'], $board_config['smtp_port'], $errno, $errstr, 20) ) { mx_message_die(GENERAL_ERROR, "Could not connect to smtp host : $errno : $errstr", "", __LINE__, __FILE__); *************** *** 120,123 **** --- 132,153 ---- if( !empty($board_config['smtp_username']) && !empty($board_config['smtp_password']) ) { + server_send('AUTH PLAIN'); + if ($err_msg = server_parse('334', __LINE__)) + { + return $err_msg; + } + + $base64_method_plain = base64_encode("\0" . $board_config['smtp_username'] . "\0" . $board_config['smtp_password']); + server_send($base64_method_plain, true); + if ($err_msg = server_parse('235', __LINE__)) + { + return $err_msg; + } + + return false; + + } + else if(!empty($board_config['smtp_username']) && !empty($board_config['smtp_login'])) + { fputs($socket, "EHLO " . $board_config['smtp_host'] . "\r\n"); server_parse($socket, "250", __LINE__); *************** *** 131,135 **** fputs($socket, base64_encode($board_config['smtp_password']) . "\r\n"); server_parse($socket, "235", __LINE__); ! } else { --- 161,165 ---- fputs($socket, base64_encode($board_config['smtp_password']) . "\r\n"); server_parse($socket, "235", __LINE__); ! } else { |