Version 3.1.4
This commit is contained in:
1 parent
1d4720f3e2
commit
ae5c01cc78
2563 files changed
+283048
-240689
No files matched your search
@@ -1,20 +1,22 @@
|
||||
<?php
|
||||
|
||||
/**
|
||||
* <pre>
|
||||
* Invision Power Services
|
||||
* IP.Board v3.0.5
|
||||
* IP.Board v3.1.4
|
||||
* Send email using php mail() or SMTP
|
||||
* Last Updated: $Date: 2009-11-10 18:07:29 -0500 (Tue, 10 Nov 2009) $
|
||||
* Last Updated: $Date: 2010-09-09 17:45:22 -0400 (Thu, 09 Sep 2010) $
|
||||
* </pre>
|
||||
*
|
||||
* @author $Author: bfarber $
|
||||
* @copyright (c) 2001 - 2009 Invision Power Services, Inc.
|
||||
* @license http://www.iinvisionpower.com/community/board/license.html
|
||||
* @package Invision Power Services Kernel
|
||||
* @link http://www.iinvisionpower.com
|
||||
* @license http://www.invisionpower.com/community/board/license.html
|
||||
* @package IP.Board
|
||||
* @subpackage Kernel
|
||||
* @link http://www.invisionpower.com
|
||||
* @since Tuesday 1st March 2005 (11:52)
|
||||
* @version $Revision: 343 $
|
||||
* @version $Revision: 459 $
|
||||
*
|
||||
* @todo [Future] Support receiving and parsing emails and attachments
|
||||
*
|
||||
* Example usage:
|
||||
* <code>
|
||||
@@ -26,7 +28,7 @@
|
||||
* 'charset' => 'utf-8',
|
||||
* )
|
||||
* );
|
||||
* $email->setFrom( "dont@mail.me", "This is\r\nan email" );
|
||||
* $email->setFrom( "support@invisionpower.com", "This is\r\nan email" );
|
||||
* $email->setTo( "me@mydomain.com" );
|
||||
* $email->addBCC( "myfriend@mydomain.com" );
|
||||
* $email->addBCC( "myotherfriend@mydomain.com" );
|
||||
@@ -457,8 +459,6 @@ class classEmail implements interfaceEmail
|
||||
$this->parts = array();
|
||||
$this->mail_headers = array();
|
||||
$this->multipart = '';
|
||||
$this->smtp_msg = '';
|
||||
$this->smtp_code = '';
|
||||
}
|
||||
|
||||
/**
|
||||
@@ -631,7 +631,7 @@ class classEmail implements interfaceEmail
|
||||
$this->_fatalError( "Пустое поле От, Кому или Тема" );
|
||||
return false;
|
||||
}
|
||||
|
||||
|
||||
//-----------------------------------------
|
||||
// Debugging
|
||||
//-----------------------------------------
|
||||
@@ -652,7 +652,7 @@ class classEmail implements interfaceEmail
|
||||
return false;
|
||||
}
|
||||
|
||||
$pathy = $this->temp_dump_path . '/' . date("M-j-Y,hi-A") . str_replace( '@', '+', $this->to ) . '.php';
|
||||
$pathy = $this->temp_dump_path . '/' . date("M-j-Y") . '-' . time() . str_replace( '@', '+', $this->to ) . uniqid( '_' ) . '.php';
|
||||
|
||||
$fh = @fopen( $pathy, 'w' );
|
||||
@fputs( $fh, $debug, strlen($debug) );
|
||||
@@ -754,24 +754,34 @@ class classEmail implements interfaceEmail
|
||||
// so we just strip board name and continue
|
||||
//-----------------------------------------
|
||||
|
||||
if( $header == 'From' OR $header == 'Content-Type' OR $header == 'Content-Disposition' )
|
||||
if( $header == 'From' OR $header == 'Content-Type' OR $header == 'Content-Disposition' OR $header == 'Content-Transfer-Encoding' OR $header == 'v' )
|
||||
{
|
||||
$this->mail_headers[ $header ] = $orig_value;
|
||||
if ( ! count($headers) )
|
||||
{
|
||||
$this->mail_headers[ $header ] = $orig_value;
|
||||
}
|
||||
|
||||
$enc_headers[ $header ] = $orig_value;
|
||||
|
||||
continue;
|
||||
}
|
||||
|
||||
//-----------------------------------------
|
||||
// We don't want to keep subject in the
|
||||
// headers for php mail
|
||||
//-----------------------------------------
|
||||
|
||||
if( $this->mail_method != 'smtp' AND $header == 'Subject' )
|
||||
|
||||
if( $header == 'Subject' OR $header == 'FDispay' )
|
||||
{
|
||||
$val= '=?' .$this->char_set .'?B?' .base64_encode($orig_value) .'?=';
|
||||
|
||||
if( !count($headers) )
|
||||
{
|
||||
$this->mail_headers[ $header ] = $val;
|
||||
}
|
||||
else
|
||||
{
|
||||
$enc_headers[ $header ] = $val;
|
||||
}
|
||||
|
||||
continue;
|
||||
}
|
||||
|
||||
|
||||
//-----------------------------------------
|
||||
// Don't bother encoding unless we have chars
|
||||
// that need to be encoded
|
||||
@@ -779,7 +789,11 @@ class classEmail implements interfaceEmail
|
||||
|
||||
if( !preg_match( '/(\w*[\x80-\xFF]+\w*)/', $value ) )
|
||||
{
|
||||
$this->mail_headers[ $header ] = $orig_value;
|
||||
if( $header != 'Subject' )
|
||||
{
|
||||
$this->mail_headers[ $header ] = $orig_value;
|
||||
}
|
||||
|
||||
$enc_headers[ $header ] = $orig_value;
|
||||
|
||||
continue;
|
||||
@@ -802,7 +816,7 @@ class classEmail implements interfaceEmail
|
||||
$value = preg_replace( "/" . $spacer . "$/", "", $value );
|
||||
$value = $start . $value . $end;
|
||||
|
||||
if( !count($headers) )
|
||||
if( !count($headers) AND ( $this->mail_method == 'smtp' OR $header != 'Subject' ) )
|
||||
{
|
||||
$this->mail_headers[ $header ] = $value;
|
||||
}
|
||||
@@ -855,6 +869,7 @@ class classEmail implements interfaceEmail
|
||||
|
||||
//-----------------------------------------
|
||||
// From and to...
|
||||
// @link http://community.invisionpower.com/tracker/issue-22474-mail-delivery-method-character/
|
||||
//-----------------------------------------
|
||||
|
||||
if( $this->from_display AND !preg_match( '/(\w*[\x80-\xFF]+\w*)/', $this->from_display ) )
|
||||
@@ -940,7 +955,7 @@ class classEmail implements interfaceEmail
|
||||
$extra_headers[1]['Content-Type'] = "text/plain;\n\tcharset=\"".$this->char_set."\"";
|
||||
$extra_headers[1]['notencode'] = "\n\n".$this->pt_message."\n\n--".$this->boundry."\n";
|
||||
$extra_headers[2]['Content-Type'] = "text/html;\n\tcharset=\"".$this->char_set."\"";
|
||||
$extra_headers[2]['notencode'] = "\n\n".$this->message."\n\n";
|
||||
$extra_headers[2]['notencode'] = "\n\n".$this->message."\n\n--".$this->boundry."--";
|
||||
|
||||
reset($extra_headers);
|
||||
|
||||
@@ -954,13 +969,15 @@ class classEmail implements interfaceEmail
|
||||
}
|
||||
else
|
||||
{
|
||||
$v = $this->_encodeHeaders( array( 'v' => $v ) );
|
||||
$v = $this->_encodeHeaders( array( $k => $v ) );
|
||||
|
||||
$extra_headers_rfc .= $k . ': ' . $v['v'] . self::header_eol;
|
||||
$extra_headers_rfc .= $k . ': ' . $v[ $k ] . self::header_eol;
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
unset( $this->mail_headers['Content-Type'] );
|
||||
|
||||
$this->message = "";
|
||||
}
|
||||
else
|
||||
@@ -1075,6 +1092,14 @@ class classEmail implements interfaceEmail
|
||||
*/
|
||||
private function _smtpDisconnect()
|
||||
{
|
||||
$this->_smtpSendCmd( "quit" );
|
||||
|
||||
if ( $this->smtp_code != 221 )
|
||||
{
|
||||
$this->_smtpError( "Невозможно уйти с SMTP сервера с помощью 'quit'" );
|
||||
return false;
|
||||
}
|
||||
|
||||
return @fclose( $this->smtp_fp );
|
||||
}
|
||||
|
||||
@@ -1145,7 +1170,7 @@ class classEmail implements interfaceEmail
|
||||
*/
|
||||
private function _smtpError( $err="" )
|
||||
{
|
||||
$this->smtp_msg = $err;
|
||||
//$this->smtp_msg = $err;
|
||||
$this->_fatalError( $err );
|
||||
return false;
|
||||
}
|
||||
@@ -1242,14 +1267,6 @@ class classEmail implements interfaceEmail
|
||||
$this->_smtpError( "Ошибка отправки письма" );
|
||||
return false;
|
||||
}
|
||||
|
||||
$this->_smtpSendCmd( "quit" );
|
||||
|
||||
if ( $this->smtp_code != 221 )
|
||||
{
|
||||
$this->_smtpError( "Невозможно уйти с SMTP сервера с помощью 'quit'" );
|
||||
return false;
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
|
||||
Reference in new issue
Block a user