2
2
/*~ class.phpmailer.php
3
3
.---------------------------------------------------------------------------.
4
4
| Software: PHPMailer - PHP email class |
5
- | Version: 2.0.2 |
5
+ | Version: 2.0.3 |
6
6
| Contact: via sourceforge.net support pages (also www.codeworxtech.com) |
7
7
| Info: http://phpmailer.sourceforge.net |
8
8
| Support: http://sourceforge.net/projects/phpmailer/ |
@@ -139,7 +139,7 @@ class PHPMailer {
139
139
* Holds PHPMailer version.
140
140
* @var string
141
141
*/
142
- var $ Version = "2.0.2 " ;
142
+ var $ Version = "2.0.3 " ;
143
143
144
144
/**
145
145
* Sets the email address that a reading confirmation will be sent.
@@ -256,7 +256,8 @@ class PHPMailer {
256
256
var $ boundary = array ();
257
257
var $ language = array ();
258
258
var $ error_count = 0 ;
259
- var $ LE = "\n" ;
259
+ var $ LE = "\r\n" ;
260
+ var $ sign_cert_file = "" ;
260
261
var $ sign_key_file = "" ;
261
262
var $ sign_key_pass = "" ;
262
263
@@ -649,8 +650,20 @@ function SetLanguage($lang_type, $lang_path = 'language/') {
649
650
} elseif (file_exists ($ lang_path .'phpmailer.lang-en.php ' )) {
650
651
include ($ lang_path .'phpmailer.lang-en.php ' );
651
652
} else {
652
- $ this ->SetError ('Could not load language file ' );
653
- return false ;
653
+ $ PHPMAILER_LANG = array ();
654
+ $ PHPMAILER_LANG ["provide_address " ] = 'You must provide at least one ' .
655
+ $ PHPMAILER_LANG ["mailer_not_supported " ] = ' mailer is not supported. ' ;
656
+ $ PHPMAILER_LANG ["execute " ] = 'Could not execute: ' ;
657
+ $ PHPMAILER_LANG ["instantiate " ] = 'Could not instantiate mail function. ' ;
658
+ $ PHPMAILER_LANG ["authenticate " ] = 'SMTP Error: Could not authenticate. ' ;
659
+ $ PHPMAILER_LANG ["from_failed " ] = 'The following From address failed: ' ;
660
+ $ PHPMAILER_LANG ["recipients_failed " ] = 'SMTP Error: The following ' .
661
+ $ PHPMAILER_LANG ["data_not_accepted " ] = 'SMTP Error: Data not accepted. ' ;
662
+ $ PHPMAILER_LANG ["connect_host " ] = 'SMTP Error: Could not connect to SMTP host. ' ;
663
+ $ PHPMAILER_LANG ["file_access " ] = 'Could not access file: ' ;
664
+ $ PHPMAILER_LANG ["file_open " ] = 'File Error: Could not open file: ' ;
665
+ $ PHPMAILER_LANG ["encoding " ] = 'Unknown encoding: ' ;
666
+ $ PHPMAILER_LANG ["signing " ] = 'Signing Error: ' ;
654
667
}
655
668
$ this ->language = $ PHPMAILER_LANG ;
656
669
@@ -864,9 +877,6 @@ function CreateHeader() {
864
877
} elseif (count ($ this ->cc ) == 0 ) {
865
878
$ result .= $ this ->HeaderLine ('To ' , 'undisclosed-recipients:; ' );
866
879
}
867
- if (count ($ this ->cc ) > 0 ) {
868
- $ result .= $ this ->AddrAppend ('Cc ' , $ this ->cc );
869
- }
870
880
}
871
881
872
882
$ from = array ();
@@ -1007,9 +1017,13 @@ function CreateBody() {
1007
1017
fclose ($ fp );
1008
1018
$ signed = tempnam ("" , "signed " );
1009
1019
1010
- if (@openssl_pkcs7_sign ($ file , $ signed , "file:// " .$ this ->sign_key_file , array ("file:// " .$ this ->sign_key_file , $ this ->sign_key_pass ), null )) {
1020
+ if (@openssl_pkcs7_sign ($ file , $ signed , "file:// " .$ this ->sign_cert_file , array ("file:// " .$ this ->sign_key_file , $ this ->sign_key_pass ), null )) {
1011
1021
$ fp = fopen ($ signed , "r " );
1012
1022
$ result = fread ($ fp , filesize ($ this ->sign_key_file ));
1023
+ $ result = '' ;
1024
+ while (!feof ($ fp )){
1025
+ $ result = $ result . fread ($ fp , 1024 );
1026
+ }
1013
1027
fclose ($ fp );
1014
1028
} else {
1015
1029
$ this ->SetError ($ this ->Lang ("signing " ).openssl_error_string ());
@@ -1159,14 +1173,14 @@ function AttachAll() {
1159
1173
$ cid = $ this ->attachment [$ i ][7 ];
1160
1174
1161
1175
$ mime [] = sprintf ("--%s%s " , $ this ->boundary [1 ], $ this ->LE );
1162
- $ mime [] = sprintf ("Content-Type: %s; name= \"%s \"%s " , $ type , $ name , $ this ->LE );
1176
+ $ mime [] = sprintf ("Content-Type: %s; name= \"%s \"%s " , $ type , $ this -> EncodeHeader ( $ this -> SecureHeader ( $ name)) , $ this ->LE );
1163
1177
$ mime [] = sprintf ("Content-Transfer-Encoding: %s%s " , $ encoding , $ this ->LE );
1164
1178
1165
1179
if ($ disposition == 'inline ' ) {
1166
1180
$ mime [] = sprintf ("Content-ID: <%s>%s " , $ cid , $ this ->LE );
1167
1181
}
1168
1182
1169
- $ mime [] = sprintf ("Content-Disposition: %s; filename= \"%s \"%s " , $ disposition , $ name , $ this ->LE .$ this ->LE );
1183
+ $ mime [] = sprintf ("Content-Disposition: %s; filename= \"%s \"%s " , $ disposition , $ this -> EncodeHeader ( $ this -> SecureHeader ( $ name)) , $ this ->LE .$ this ->LE );
1170
1184
1171
1185
/* Encode as string attachment */
1172
1186
if ($ bString ) {
@@ -1399,7 +1413,7 @@ function EncodeQP( $input = '', $line_max = 76, $space_conv = false ) {
1399
1413
} // end of for
1400
1414
$ output .= $ newline .$ eol ;
1401
1415
} // end of while
1402
- return trim ( $ output) ;
1416
+ return $ output ;
1403
1417
}
1404
1418
1405
1419
/**
@@ -1710,8 +1724,7 @@ function MsgHTML($message,$basedir='') {
1710
1724
$ ext = $ fileParts [1 ];
1711
1725
$ mimeType = $ this ->_mime_types ($ ext );
1712
1726
if ( strlen ($ basedir ) > 1 && substr ($ basedir ,-1 ) != '/ ' ) { $ basedir .= '/ ' ; }
1713
- if ( strlen ($ directory ) > 1 && substr ($ basedir ,-1 ) != '/ ' ) { $ directory .= '/ ' ; }
1714
- $ this ->AddEmbeddedImage ($ basedir .$ directory .$ filename , md5 ($ filename ), $ filename , 'base64 ' , $ mimeType );
1727
+ if ( strlen ($ directory ) > 1 && substr ($ directory ,-1 ) != '/ ' ) { $ directory .= '/ ' ; }
1715
1728
if ( $ this ->AddEmbeddedImage ($ basedir .$ directory .$ filename , md5 ($ filename ), $ filename , 'base64 ' ,$ mimeType ) ) {
1716
1729
$ message = preg_replace ("/ " .$ images [1 ][$ i ]."= \"" .preg_quote ($ url , '/ ' )."\"/Ui " , $ images [1 ][$ i ]."= \"" .$ cid ."\"" , $ message );
1717
1730
}
@@ -1722,7 +1735,7 @@ function MsgHTML($message,$basedir='') {
1722
1735
$ this ->Body = $ message ;
1723
1736
$ textMsg = trim (strip_tags (preg_replace ('/<(head|title|style|script)[^>]*>.*?<\/ \\1>/s ' ,'' ,$ message )));
1724
1737
if ( !empty ($ textMsg ) && empty ($ this ->AltBody ) ) {
1725
- $ this ->AltBody = $ textMsg ;
1738
+ $ this ->AltBody = html_entity_decode ( $ textMsg) ;
1726
1739
}
1727
1740
if ( empty ($ this ->AltBody ) ) {
1728
1741
$ this ->AltBody = 'To view this email message, open the email in with HTML compatibility! ' . "\n\n" ;
@@ -1736,93 +1749,92 @@ function MsgHTML($message,$basedir='') {
1736
1749
*/
1737
1750
function _mime_types ($ ext = '' ) {
1738
1751
$ mimes = array (
1739
- 'hqx ' => 'application/mac-binhex40 ' ,
1740
- 'cpt ' => 'application/mac-compactpro ' ,
1741
- 'doc ' => 'application/msword ' ,
1752
+ 'ai ' => 'application/postscript ' ,
1753
+ 'aif ' => 'audio/x-aiff ' ,
1754
+ 'aifc ' => 'audio/x-aiff ' ,
1755
+ 'aiff ' => 'audio/x-aiff ' ,
1756
+ 'avi ' => 'video/x-msvideo ' ,
1742
1757
'bin ' => 'application/macbinary ' ,
1743
- 'dms ' => 'application/octet-stream ' ,
1744
- 'lha ' => 'application/octet-stream ' ,
1745
- 'lzh ' => 'application/octet-stream ' ,
1746
- 'exe ' => 'application/octet-stream ' ,
1758
+ 'bmp ' => 'image/bmp ' ,
1747
1759
'class ' => 'application/octet-stream ' ,
1748
- 'psd ' => 'application/octet-stream ' ,
1749
- 'so ' => 'application/octet-stream ' ,
1750
- 'sea ' => 'application/octet-stream ' ,
1751
- 'dll ' => 'application/octet-stream ' ,
1752
- 'oda ' => 'application/oda ' ,
1753
- 'pdf ' => 'application/pdf ' ,
1754
- 'ai ' => 'application/postscript ' ,
1755
- 'eps ' => 'application/postscript ' ,
1756
- 'ps ' => 'application/postscript ' ,
1757
- 'smi ' => 'application/smil ' ,
1758
- 'smil ' => 'application/smil ' ,
1759
- 'mif ' => 'application/vnd.mif ' ,
1760
- 'xls ' => 'application/vnd.ms-excel ' ,
1761
- 'ppt ' => 'application/vnd.ms-powerpoint ' ,
1762
- 'wbxml ' => 'application/vnd.wap.wbxml ' ,
1763
- 'wmlc ' => 'application/vnd.wap.wmlc ' ,
1760
+ 'cpt ' => 'application/mac-compactpro ' ,
1761
+ 'css ' => 'text/css ' ,
1764
1762
'dcr ' => 'application/x-director ' ,
1765
1763
'dir ' => 'application/x-director ' ,
1766
- 'dxr ' => 'application/x-director ' ,
1764
+ 'dll ' => 'application/octet-stream ' ,
1765
+ 'dms ' => 'application/octet-stream ' ,
1766
+ 'doc ' => 'application/msword ' ,
1767
1767
'dvi ' => 'application/x-dvi ' ,
1768
+ 'dxr ' => 'application/x-director ' ,
1769
+ 'eml ' => 'message/rfc822 ' ,
1770
+ 'eps ' => 'application/postscript ' ,
1771
+ 'exe ' => 'application/octet-stream ' ,
1772
+ 'gif ' => 'image/gif ' ,
1768
1773
'gtar ' => 'application/x-gtar ' ,
1769
- 'php ' => 'application/x-httpd-php ' ,
1770
- 'php4 ' => 'application/x-httpd-php ' ,
1771
- 'php3 ' => 'application/x-httpd-php ' ,
1772
- 'phtml ' => 'application/x-httpd-php ' ,
1773
- 'phps ' => 'application/x-httpd-php-source ' ,
1774
+ 'htm ' => 'text/html ' ,
1775
+ 'html ' => 'text/html ' ,
1776
+ 'jpe ' => 'image/jpeg ' ,
1777
+ 'jpeg ' => 'image/jpeg ' ,
1778
+ 'jpg ' => 'image/jpeg ' ,
1779
+ 'hqx ' => 'application/mac-binhex40 ' ,
1774
1780
'js ' => 'application/x-javascript ' ,
1775
- 'swf ' => 'application/x-shockwave-flash ' ,
1776
- 'sit ' => 'application/x-stuffit ' ,
1777
- 'tar ' => 'application/x-tar ' ,
1778
- 'tgz ' => 'application/x-tar ' ,
1779
- 'xhtml ' => 'application/xhtml+xml ' ,
1780
- 'xht ' => 'application/xhtml+xml ' ,
1781
- 'zip ' => 'application/zip ' ,
1781
+ 'lha ' => 'application/octet-stream ' ,
1782
+ 'log ' => 'text/plain ' ,
1783
+ 'lzh ' => 'application/octet-stream ' ,
1782
1784
'mid ' => 'audio/midi ' ,
1783
1785
'midi ' => 'audio/midi ' ,
1784
- 'mpga ' => 'audio/mpeg ' ,
1786
+ 'mif ' => 'application/vnd.mif ' ,
1787
+ 'mov ' => 'video/quicktime ' ,
1788
+ 'movie ' => 'video/x-sgi-movie ' ,
1785
1789
'mp2 ' => 'audio/mpeg ' ,
1786
1790
'mp3 ' => 'audio/mpeg ' ,
1787
- 'aif ' => 'audio/x-aiff ' ,
1788
- 'aiff ' => 'audio/x-aiff ' ,
1789
- 'aifc ' => 'audio/x-aiff ' ,
1791
+ 'mpe ' => 'video/mpeg ' ,
1792
+ 'mpeg ' => 'video/mpeg ' ,
1793
+ 'mpg ' => 'video/mpeg ' ,
1794
+ 'mpga ' => 'audio/mpeg ' ,
1795
+ 'oda ' => 'application/oda ' ,
1796
+ 'pdf ' => 'application/pdf ' ,
1797
+ 'php ' => 'application/x-httpd-php ' ,
1798
+ 'php3 ' => 'application/x-httpd-php ' ,
1799
+ 'php4 ' => 'application/x-httpd-php ' ,
1800
+ 'phps ' => 'application/x-httpd-php-source ' ,
1801
+ 'phtml ' => 'application/x-httpd-php ' ,
1802
+ 'png ' => 'image/png ' ,
1803
+ 'ppt ' => 'application/vnd.ms-powerpoint ' ,
1804
+ 'ps ' => 'application/postscript ' ,
1805
+ 'psd ' => 'application/octet-stream ' ,
1806
+ 'qt ' => 'video/quicktime ' ,
1807
+ 'ra ' => 'audio/x-realaudio ' ,
1790
1808
'ram ' => 'audio/x-pn-realaudio ' ,
1791
1809
'rm ' => 'audio/x-pn-realaudio ' ,
1792
1810
'rpm ' => 'audio/x-pn-realaudio-plugin ' ,
1793
- 'ra ' => 'audio/x-realaudio ' ,
1811
+ 'rtf ' => 'text/rtf ' ,
1812
+ 'rtx ' => 'text/richtext ' ,
1794
1813
'rv ' => 'video/vnd.rn-realvideo ' ,
1795
- 'wav ' => 'audio/x-wav ' ,
1796
- 'bmp ' => 'image/bmp ' ,
1797
- 'gif ' => 'image/gif ' ,
1798
- 'jpeg ' => 'image/jpeg ' ,
1799
- 'jpg ' => 'image/jpeg ' ,
1800
- 'jpe ' => 'image/jpeg ' ,
1801
- 'png ' => 'image/png ' ,
1802
- 'tiff ' => 'image/tiff ' ,
1803
- 'tif ' => 'image/tiff ' ,
1804
- 'css ' => 'text/css ' ,
1805
- 'html ' => 'text/html ' ,
1806
- 'htm ' => 'text/html ' ,
1814
+ 'sea ' => 'application/octet-stream ' ,
1807
1815
'shtml ' => 'text/html ' ,
1808
- 'txt ' => 'text/plain ' ,
1816
+ 'sit ' => 'application/x-stuffit ' ,
1817
+ 'so ' => 'application/octet-stream ' ,
1818
+ 'smi ' => 'application/smil ' ,
1819
+ 'smil ' => 'application/smil ' ,
1820
+ 'swf ' => 'application/x-shockwave-flash ' ,
1821
+ 'tar ' => 'application/x-tar ' ,
1809
1822
'text ' => 'text/plain ' ,
1810
- 'log ' => 'text/plain ' ,
1811
- 'rtx ' => 'text/richtext ' ,
1812
- 'rtf ' => 'text/rtf ' ,
1813
- 'xml ' => 'text/xml ' ,
1814
- 'xsl ' => 'text/xml ' ,
1815
- 'mpeg ' => 'video/mpeg ' ,
1816
- 'mpg ' => 'video/mpeg ' ,
1817
- 'mpe ' => 'video/mpeg ' ,
1818
- 'qt ' => 'video/quicktime ' ,
1819
- 'mov ' => 'video/quicktime ' ,
1820
- 'avi ' => 'video/x-msvideo ' ,
1821
- 'movie ' => 'video/x-sgi-movie ' ,
1822
- 'doc ' => 'application/msword ' ,
1823
+ 'txt ' => 'text/plain ' ,
1824
+ 'tgz ' => 'application/x-tar ' ,
1825
+ 'tif ' => 'image/tiff ' ,
1826
+ 'tiff ' => 'image/tiff ' ,
1827
+ 'wav ' => 'audio/x-wav ' ,
1828
+ 'wbxml ' => 'application/vnd.wap.wbxml ' ,
1829
+ 'wmlc ' => 'application/vnd.wap.wmlc ' ,
1823
1830
'word ' => 'application/msword ' ,
1831
+ 'xht ' => 'application/xhtml+xml ' ,
1832
+ 'xhtml ' => 'application/xhtml+xml ' ,
1824
1833
'xl ' => 'application/excel ' ,
1825
- 'eml ' => 'message/rfc822 '
1834
+ 'xls ' => 'application/vnd.ms-excel ' ,
1835
+ 'xml ' => 'text/xml ' ,
1836
+ 'xsl ' => 'text/xml ' ,
1837
+ 'zip ' => 'application/zip '
1826
1838
);
1827
1839
return ( ! isset ($ mimes [strtolower ($ ext )])) ? 'application/octet-stream ' : $ mimes [strtolower ($ ext )];
1828
1840
}
@@ -1886,11 +1898,12 @@ function SecureHeader($str) {
1886
1898
* @param string $key_filename Parameter File Name
1887
1899
* @param string $key_pass Password for private key
1888
1900
*/
1889
- function Sign ($ key_filename , $ key_pass ) {
1901
+ function Sign ($ cert_filename , $ key_filename , $ key_pass ) {
1902
+ $ this ->sign_cert_file = $ cert_filename ;
1890
1903
$ this ->sign_key_file = $ key_filename ;
1891
1904
$ this ->sign_key_pass = $ key_pass ;
1892
1905
}
1893
1906
1894
1907
}
1895
1908
1896
- ?>
1909
+ ?>
0 commit comments