Revision 1374
Added by Dietmar almost 14 years ago
class.phpmailer.php | ||
---|---|---|
46 | 46 |
|
47 | 47 |
/** |
48 | 48 |
* Email priority (1 = High, 3 = Normal, 5 = low). |
49 |
* @var int
|
|
49 |
* @var int |
|
50 | 50 |
*/ |
51 | 51 |
var $Priority = 3; |
52 | 52 |
|
53 | 53 |
/** |
54 | 54 |
* Sets the CharSet of the message. |
55 |
* @var string
|
|
55 |
* @var string |
|
56 | 56 |
*/ |
57 | 57 |
var $CharSet = 'iso-8859-1'; |
58 | 58 |
|
59 | 59 |
/** |
60 | 60 |
* Sets the Content-type of the message. |
61 |
* @var string
|
|
61 |
* @var string |
|
62 | 62 |
*/ |
63 | 63 |
var $ContentType = 'text/plain'; |
64 | 64 |
|
65 | 65 |
/** |
66 | 66 |
* Sets the Encoding of the message. Options for this are "8bit", |
67 | 67 |
* "7bit", "binary", "base64", and "quoted-printable". |
68 |
* @var string
|
|
68 |
* @var string |
|
69 | 69 |
*/ |
70 | 70 |
var $Encoding = '8bit'; |
71 | 71 |
|
72 | 72 |
/** |
73 | 73 |
* Holds the most recent mailer error message. |
74 |
* @var string
|
|
74 |
* @var string |
|
75 | 75 |
*/ |
76 | 76 |
var $ErrorInfo = ''; |
77 | 77 |
|
78 | 78 |
/** |
79 | 79 |
* Sets the From email address for the message. |
80 |
* @var string
|
|
80 |
* @var string |
|
81 | 81 |
*/ |
82 | 82 |
var $From = 'root@localhost'; |
83 | 83 |
|
84 | 84 |
/** |
85 | 85 |
* Sets the From name of the message. |
86 |
* @var string
|
|
86 |
* @var string |
|
87 | 87 |
*/ |
88 | 88 |
var $FromName = 'Root User'; |
89 | 89 |
|
90 | 90 |
/** |
91 | 91 |
* Sets the Sender email (Return-Path) of the message. If not empty, |
92 | 92 |
* will be sent via -f to sendmail or as 'MAIL FROM' in smtp mode. |
93 |
* @var string
|
|
93 |
* @var string |
|
94 | 94 |
*/ |
95 | 95 |
var $Sender = ''; |
96 | 96 |
|
97 | 97 |
/** |
98 | 98 |
* Sets the Subject of the message. |
99 |
* @var string
|
|
99 |
* @var string |
|
100 | 100 |
*/ |
101 | 101 |
var $Subject = ''; |
102 | 102 |
|
103 | 103 |
/** |
104 | 104 |
* Sets the Body of the message. This can be either an HTML or text body. |
105 | 105 |
* If HTML then run IsHTML(true). |
106 |
* @var string
|
|
106 |
* @var string |
|
107 | 107 |
*/ |
108 | 108 |
var $Body = ''; |
109 | 109 |
|
... | ... | |
112 | 112 |
* email to multipart/alternative. This body can be read by mail |
113 | 113 |
* clients that do not have HTML email capability such as mutt. Clients |
114 | 114 |
* that can read HTML will view the normal Body. |
115 |
* @var string
|
|
115 |
* @var string |
|
116 | 116 |
*/ |
117 | 117 |
var $AltBody = ''; |
118 | 118 |
|
119 | 119 |
/** |
120 | 120 |
* Sets word wrapping on the body of the message to a given number of |
121 | 121 |
* characters. |
122 |
* @var int
|
|
122 |
* @var int |
|
123 | 123 |
*/ |
124 | 124 |
var $WordWrap = 0; |
125 | 125 |
|
126 | 126 |
/** |
127 | 127 |
* Method to send mail: ("mail", "sendmail", or "smtp"). |
128 |
* @var string
|
|
128 |
* @var string |
|
129 | 129 |
*/ |
130 | 130 |
var $Mailer = 'mail'; |
131 | 131 |
|
132 | 132 |
/** |
133 | 133 |
* Sets the path of the sendmail program. |
134 |
* @var string
|
|
134 |
* @var string |
|
135 | 135 |
*/ |
136 | 136 |
var $Sendmail = '/usr/sbin/sendmail'; |
137 | 137 |
|
138 | 138 |
/** |
139 | 139 |
* Path to PHPMailer plugins. This is now only useful if the SMTP class |
140 | 140 |
* is in a different directory than the PHP include path. |
141 |
* @var string
|
|
141 |
* @var string |
|
142 | 142 |
*/ |
143 | 143 |
var $PluginDir = ''; |
144 | 144 |
|
145 | 145 |
/** |
146 | 146 |
* Holds PHPMailer version. |
147 |
* @var string
|
|
147 |
* @var string |
|
148 | 148 |
*/ |
149 | 149 |
var $Version = "2.0.4"; |
150 | 150 |
|
151 | 151 |
/** |
152 | 152 |
* Sets the email address that a reading confirmation will be sent. |
153 |
* @var string
|
|
153 |
* @var string |
|
154 | 154 |
*/ |
155 | 155 |
var $ConfirmReadingTo = ''; |
156 | 156 |
|
... | ... | |
158 | 158 |
* Sets the hostname to use in Message-Id and Received headers |
159 | 159 |
* and as default HELO string. If empty, the value returned |
160 | 160 |
* by SERVER_NAME is used or 'localhost.localdomain'. |
161 |
* @var string
|
|
161 |
* @var string |
|
162 | 162 |
*/ |
163 | 163 |
var $Hostname = ''; |
164 | 164 |
|
165 | 165 |
/** |
166 | 166 |
* Sets the message ID to be used in the Message-Id header. |
167 | 167 |
* If empty, a unique id will be generated. |
168 |
* @var string
|
|
168 |
* @var string |
|
169 | 169 |
*/ |
170 | 170 |
var $MessageID = ''; |
171 | 171 |
|
... | ... | |
179 | 179 |
* for each host by using this format: [hostname:port] |
180 | 180 |
* (e.g. "smtp1.example.com:25;smtp2.example.com"). |
181 | 181 |
* Hosts will be tried in order. |
182 |
* @var string
|
|
182 |
* @var string |
|
183 | 183 |
*/ |
184 | 184 |
var $Host = 'localhost'; |
185 | 185 |
|
186 | 186 |
/** |
187 | 187 |
* Sets the default SMTP server port. |
188 |
* @var int
|
|
188 |
* @var int |
|
189 | 189 |
*/ |
190 | 190 |
var $Port = 25; |
191 | 191 |
|
192 | 192 |
/** |
193 | 193 |
* Sets the SMTP HELO of the message (Default is $Hostname). |
194 |
* @var string
|
|
194 |
* @var string |
|
195 | 195 |
*/ |
196 | 196 |
var $Helo = ''; |
197 | 197 |
|
198 | 198 |
/** |
199 | 199 |
* Sets connection prefix. |
200 | 200 |
* Options are "", "ssl" or "tls" |
201 |
* @var string
|
|
201 |
* @var string |
|
202 | 202 |
*/ |
203 | 203 |
var $SMTPSecure = ""; |
204 | 204 |
|
205 | 205 |
/** |
206 | 206 |
* Sets SMTP authentication. Utilizes the Username and Password variables. |
207 |
* @var bool
|
|
207 |
* @var bool |
|
208 | 208 |
*/ |
209 | 209 |
var $SMTPAuth = false; |
210 | 210 |
|
211 | 211 |
/** |
212 | 212 |
* Sets SMTP username. |
213 |
* @var string
|
|
213 |
* @var string |
|
214 | 214 |
*/ |
215 | 215 |
var $Username = ''; |
216 | 216 |
|
217 | 217 |
/** |
218 | 218 |
* Sets SMTP password. |
219 |
* @var string
|
|
219 |
* @var string |
|
220 | 220 |
*/ |
221 | 221 |
var $Password = ''; |
222 | 222 |
|
223 | 223 |
/** |
224 | 224 |
* Sets the SMTP server timeout in seconds. This function will not |
225 | 225 |
* work with the win32 version. |
226 |
* @var int
|
|
226 |
* @var int |
|
227 | 227 |
*/ |
228 | 228 |
var $Timeout = 10; |
229 | 229 |
|
230 | 230 |
/** |
231 | 231 |
* Sets SMTP class debugging on or off. |
232 |
* @var bool
|
|
232 |
* @var bool |
|
233 | 233 |
*/ |
234 | 234 |
var $SMTPDebug = false; |
235 | 235 |
|
... | ... | |
237 | 237 |
* Prevents the SMTP connection from being closed after each mail |
238 | 238 |
* sending. If this is set to true then to close the connection |
239 | 239 |
* requires an explicit call to SmtpClose(). |
240 |
* @var bool
|
|
240 |
* @var bool |
|
241 | 241 |
*/ |
242 | 242 |
var $SMTPKeepAlive = false; |
243 | 243 |
|
244 | 244 |
/** |
245 | 245 |
* Provides the ability to have the TO field process individual |
246 | 246 |
* emails, instead of sending to entire TO addresses |
247 |
* @var bool
|
|
247 |
* @var bool |
|
248 | 248 |
*/ |
249 | 249 |
var $SingleTo = false; |
250 | 250 |
|
... | ... | |
274 | 274 |
|
275 | 275 |
/** |
276 | 276 |
* Sets message type to HTML. |
277 |
* @param bool $bool
|
|
278 |
* @return void
|
|
277 |
* @param bool $bool |
|
278 |
* @return void |
|
279 | 279 |
*/ |
280 | 280 |
function IsHTML($bool) { |
281 | 281 |
if($bool == true) { |
... | ... | |
287 | 287 |
|
288 | 288 |
/** |
289 | 289 |
* Sets Mailer to send message using SMTP. |
290 |
* @return void
|
|
290 |
* @return void |
|
291 | 291 |
*/ |
292 | 292 |
function IsSMTP() { |
293 | 293 |
$this->Mailer = 'smtp'; |
... | ... | |
295 | 295 |
|
296 | 296 |
/** |
297 | 297 |
* Sets Mailer to send message using PHP mail() function. |
298 |
* @return void
|
|
298 |
* @return void |
|
299 | 299 |
*/ |
300 | 300 |
function IsMail() { |
301 | 301 |
$this->Mailer = 'mail'; |
... | ... | |
303 | 303 |
|
304 | 304 |
/** |
305 | 305 |
* Sets Mailer to send message using the $Sendmail program. |
306 |
* @return void
|
|
306 |
* @return void |
|
307 | 307 |
*/ |
308 | 308 |
function IsSendmail() { |
309 | 309 |
$this->Mailer = 'sendmail'; |
... | ... | |
311 | 311 |
|
312 | 312 |
/** |
313 | 313 |
* Sets Mailer to send message using the qmail MTA. |
314 |
* @return void
|
|
314 |
* @return void |
|
315 | 315 |
*/ |
316 | 316 |
function IsQmail() { |
317 | 317 |
$this->Sendmail = '/var/qmail/bin/sendmail'; |
... | ... | |
324 | 324 |
|
325 | 325 |
/** |
326 | 326 |
* Adds a "To" address. |
327 |
* @param string $address
|
|
328 |
* @param string $name
|
|
329 |
* @return void
|
|
327 |
* @param string $address |
|
328 |
* @param string $name |
|
329 |
* @return void |
|
330 | 330 |
*/ |
331 | 331 |
function AddAddress($address, $name = '') { |
332 | 332 |
$cur = count($this->to); |
... | ... | |
338 | 338 |
* Adds a "Cc" address. Note: this function works |
339 | 339 |
* with the SMTP mailer on win32, not with the "mail" |
340 | 340 |
* mailer. |
341 |
* @param string $address
|
|
342 |
* @param string $name
|
|
343 |
* @return void
|
|
341 |
* @param string $address |
|
342 |
* @param string $name |
|
343 |
* @return void |
|
344 | 344 |
*/ |
345 | 345 |
function AddCC($address, $name = '') { |
346 | 346 |
$cur = count($this->cc); |
... | ... | |
352 | 352 |
* Adds a "Bcc" address. Note: this function works |
353 | 353 |
* with the SMTP mailer on win32, not with the "mail" |
354 | 354 |
* mailer. |
355 |
* @param string $address
|
|
356 |
* @param string $name
|
|
357 |
* @return void
|
|
355 |
* @param string $address |
|
356 |
* @param string $name |
|
357 |
* @return void |
|
358 | 358 |
*/ |
359 | 359 |
function AddBCC($address, $name = '') { |
360 | 360 |
$cur = count($this->bcc); |
... | ... | |
364 | 364 |
|
365 | 365 |
/** |
366 | 366 |
* Adds a "Reply-To" address. |
367 |
* @param string $address
|
|
368 |
* @param string $name
|
|
369 |
* @return void
|
|
367 |
* @param string $address |
|
368 |
* @param string $name |
|
369 |
* @return void |
|
370 | 370 |
*/ |
371 | 371 |
function AddReplyTo($address, $name = '') { |
372 | 372 |
$cur = count($this->ReplyTo); |
... | ... | |
382 | 382 |
* Creates message and assigns Mailer. If the message is |
383 | 383 |
* not sent successfully then it returns false. Use the ErrorInfo |
384 | 384 |
* variable to view description of the error. |
385 |
* @return bool
|
|
385 |
* @return bool |
|
386 | 386 |
*/ |
387 | 387 |
function Send() { |
388 | 388 |
$header = ''; |
... | ... | |
432 | 432 |
|
433 | 433 |
/** |
434 | 434 |
* Sends mail using the $Sendmail program. |
435 |
* @access private
|
|
436 |
* @return bool
|
|
435 |
* @access private |
|
436 |
* @return bool |
|
437 | 437 |
*/ |
438 | 438 |
function SendmailSend($header, $body) { |
439 | 439 |
if ($this->Sender != '') { |
... | ... | |
463 | 463 |
|
464 | 464 |
/** |
465 | 465 |
* Sends mail using the PHP mail() function. |
466 |
* @access private
|
|
467 |
* @return bool
|
|
466 |
* @access private |
|
467 |
* @return bool |
|
468 | 468 |
*/ |
469 | 469 |
function MailSend($header, $body) { |
470 | 470 |
|
... | ... | |
513 | 513 |
* Sends mail via SMTP using PhpSMTP (Author: |
514 | 514 |
* Chris Ryan). Returns bool. Returns false if there is a |
515 | 515 |
* bad MAIL FROM, RCPT, or DATA input. |
516 |
* @access private
|
|
517 |
* @return bool
|
|
516 |
* @access private |
|
517 |
* @return bool |
|
518 | 518 |
*/ |
519 | 519 |
function SmtpSend($header, $body) { |
520 | 520 |
include_once($this->PluginDir . 'class.smtp.php'); |
... | ... | |
580 | 580 |
/** |
581 | 581 |
* Initiates a connection to an SMTP server. Returns false if the |
582 | 582 |
* operation failed. |
583 |
* @access private
|
|
584 |
* @return bool
|
|
583 |
* @access private |
|
584 |
* @return bool |
|
585 | 585 |
*/ |
586 | 586 |
function SmtpConnect() |
587 | 587 |
{ |
... | ... | |
635 | 635 |
|
636 | 636 |
/** |
637 | 637 |
* Closes the active SMTP session if one exists. |
638 |
* @return void
|
|
638 |
* @return void |
|
639 | 639 |
*/ |
640 | 640 |
function SmtpClose() { |
641 | 641 |
if($this->smtp != NULL) { |
... | ... | |
650 | 650 |
* Sets the language for all class error messages. Returns false |
651 | 651 |
* if it cannot load the language file. The default language type |
652 | 652 |
* is English. |
653 |
* @param string $lang_type Type of language (e.g. Portuguese: "br")
|
|
654 |
* @param string $lang_path Path to the language file directory
|
|
655 |
* @access public
|
|
656 |
* @return bool
|
|
653 |
* @param string $lang_type Type of language (e.g. Portuguese: "br") |
|
654 |
* @param string $lang_path Path to the language file directory |
|
655 |
* @access public |
|
656 |
* @return bool |
|
657 | 657 |
*/ |
658 | 658 |
function SetLanguage($lang_type, $lang_path = 'language/') { |
659 | 659 |
if(file_exists($lang_path.'phpmailer.lang-'.$lang_type.'.php')) { |
... | ... | |
687 | 687 |
|
688 | 688 |
/** |
689 | 689 |
* Creates recipient headers. |
690 |
* @access private
|
|
691 |
* @return string
|
|
690 |
* @access private |
|
691 |
* @return string |
|
692 | 692 |
*/ |
693 | 693 |
function AddrAppend($type, $addr) { |
694 | 694 |
$addr_str = $type . ': '; |
... | ... | |
705 | 705 |
|
706 | 706 |
/** |
707 | 707 |
* Formats an address correctly. |
708 |
* @access private
|
|
709 |
* @return string
|
|
708 |
* @access private |
|
709 |
* @return string |
|
710 | 710 |
*/ |
711 | 711 |
function AddrFormat($addr) { |
712 | 712 |
if(empty($addr[1])) { |
... | ... | |
722 | 722 |
* Wraps message for use with mailers that do not |
723 | 723 |
* automatically perform wrapping and for quoted-printable. |
724 | 724 |
* Original written by philippe. |
725 |
* @access private
|
|
726 |
* @return string
|
|
725 |
* @access private |
|
726 |
* @return string |
|
727 | 727 |
*/ |
728 | 728 |
function WrapText($message, $length, $qp_mode = false) { |
729 | 729 |
$soft_break = ($qp_mode) ? sprintf(" =%s", $this->LE) : $this->LE; |
... | ... | |
802 | 802 |
* Finds last character boundary prior to maxLength in a utf-8 |
803 | 803 |
* quoted (printable) encoded string. |
804 | 804 |
* Original written by Colin Brown. |
805 |
* @access private
|
|
806 |
* @param string $encodedText utf-8 QP text
|
|
807 |
* @param int $maxLength find last character boundary prior to this length
|
|
808 |
* @return int
|
|
805 |
* @access private |
|
806 |
* @param string $encodedText utf-8 QP text |
|
807 |
* @param int $maxLength find last character boundary prior to this length |
|
808 |
* @return int |
|
809 | 809 |
*/ |
810 | 810 |
function UTF8CharBoundary($encodedText, $maxLength) { |
811 | 811 |
$foundSplitPos = false; |
... | ... | |
841 | 841 |
|
842 | 842 |
/** |
843 | 843 |
* Set the body wrapping. |
844 |
* @access private
|
|
845 |
* @return void
|
|
844 |
* @access private |
|
845 |
* @return void |
|
846 | 846 |
*/ |
847 | 847 |
function SetWordWrap() { |
848 | 848 |
if($this->WordWrap < 1) { |
... | ... | |
863 | 863 |
|
864 | 864 |
/** |
865 | 865 |
* Assembles message header. |
866 |
* @access private
|
|
867 |
* @return string
|
|
866 |
* @access private |
|
867 |
* @return string |
|
868 | 868 |
*/ |
869 | 869 |
function CreateHeader() { |
870 | 870 |
$result = ''; |
... | ... | |
940 | 940 |
|
941 | 941 |
/** |
942 | 942 |
* Returns the message MIME. |
943 |
* @access private
|
|
944 |
* @return string
|
|
943 |
* @access private |
|
944 |
* @return string |
|
945 | 945 |
*/ |
946 | 946 |
function GetMailMIME() { |
947 | 947 |
$result = ''; |
... | ... | |
975 | 975 |
|
976 | 976 |
/** |
977 | 977 |
* Assembles the message body. Returns an empty string on failure. |
978 |
* @access private
|
|
979 |
* @return string
|
|
978 |
* @access private |
|
979 |
* @return string |
|
980 | 980 |
*/ |
981 | 981 |
function CreateBody() { |
982 | 982 |
$result = ''; |
... | ... | |
1050 | 1050 |
|
1051 | 1051 |
/** |
1052 | 1052 |
* Returns the start of a message boundary. |
1053 |
* @access private
|
|
1053 |
* @access private |
|
1054 | 1054 |
*/ |
1055 | 1055 |
function GetBoundary($boundary, $charSet, $contentType, $encoding) { |
1056 | 1056 |
$result = ''; |
... | ... | |
1074 | 1074 |
|
1075 | 1075 |
/** |
1076 | 1076 |
* Returns the end of a message boundary. |
1077 |
* @access private
|
|
1077 |
* @access private |
|
1078 | 1078 |
*/ |
1079 | 1079 |
function EndBoundary($boundary) { |
1080 | 1080 |
return $this->LE . '--' . $boundary . '--' . $this->LE; |
... | ... | |
1082 | 1082 |
|
1083 | 1083 |
/** |
1084 | 1084 |
* Sets the message type. |
1085 |
* @access private
|
|
1086 |
* @return void
|
|
1085 |
* @access private |
|
1086 |
* @return void |
|
1087 | 1087 |
*/ |
1088 | 1088 |
function SetMessageType() { |
1089 | 1089 |
if(count($this->attachment) < 1 && strlen($this->AltBody) < 1) { |
... | ... | |
1102 | 1102 |
} |
1103 | 1103 |
|
1104 | 1104 |
/* Returns a formatted header line. |
1105 |
* @access private
|
|
1106 |
* @return string
|
|
1105 |
* @access private |
|
1106 |
* @return string |
|
1107 | 1107 |
*/ |
1108 | 1108 |
function HeaderLine($name, $value) { |
1109 | 1109 |
return $name . ': ' . $value . $this->LE; |
... | ... | |
1111 | 1111 |
|
1112 | 1112 |
/** |
1113 | 1113 |
* Returns a formatted mail line. |
1114 |
* @access private
|
|
1115 |
* @return string
|
|
1114 |
* @access private |
|
1115 |
* @return string |
|
1116 | 1116 |
*/ |
1117 | 1117 |
function TextLine($value) { |
1118 | 1118 |
return $value . $this->LE; |
... | ... | |
1126 | 1126 |
* Adds an attachment from a path on the filesystem. |
1127 | 1127 |
* Returns false if the file could not be found |
1128 | 1128 |
* or accessed. |
1129 |
* @param string $path Path to the attachment.
|
|
1130 |
* @param string $name Overrides the attachment name.
|
|
1131 |
* @param string $encoding File encoding (see $Encoding).
|
|
1132 |
* @param string $type File extension (MIME) type.
|
|
1133 |
* @return bool
|
|
1129 |
* @param string $path Path to the attachment. |
|
1130 |
* @param string $name Overrides the attachment name. |
|
1131 |
* @param string $encoding File encoding (see $Encoding). |
|
1132 |
* @param string $type File extension (MIME) type. |
|
1133 |
* @return bool |
|
1134 | 1134 |
*/ |
1135 | 1135 |
function AddAttachment($path, $name = '', $encoding = 'base64', $type = 'application/octet-stream') { |
1136 | 1136 |
if(!@is_file($path)) { |
... | ... | |
1159 | 1159 |
/** |
1160 | 1160 |
* Attaches all fs, string, and binary attachments to the message. |
1161 | 1161 |
* Returns an empty string on failure. |
1162 |
* @access private
|
|
1163 |
* @return string
|
|
1162 |
* @access private |
|
1163 |
* @return string |
|
1164 | 1164 |
*/ |
1165 | 1165 |
function AttachAll() { |
1166 | 1166 |
/* Return text of body */ |
... | ... | |
1217 | 1217 |
/** |
1218 | 1218 |
* Encodes attachment in requested format. Returns an |
1219 | 1219 |
* empty string on failure. |
1220 |
* @access private
|
|
1221 |
* @return string
|
|
1220 |
* @access private |
|
1221 |
* @return string |
|
1222 | 1222 |
*/ |
1223 | 1223 |
function EncodeFile ($path, $encoding = 'base64') { |
1224 | 1224 |
if(!@$fd = fopen($path, 'rb')) { |
... | ... | |
1247 | 1247 |
/** |
1248 | 1248 |
* Encodes string to requested format. Returns an |
1249 | 1249 |
* empty string on failure. |
1250 |
* @access private
|
|
1251 |
* @return string
|
|
1250 |
* @access private |
|
1251 |
* @return string |
|
1252 | 1252 |
*/ |
1253 | 1253 |
function EncodeString ($str, $encoding = 'base64') { |
1254 | 1254 |
$encoded = ''; |
... | ... | |
1278 | 1278 |
|
1279 | 1279 |
/** |
1280 | 1280 |
* Encode a header string to best of Q, B, quoted or none. |
1281 |
* @access private
|
|
1282 |
* @return string
|
|
1281 |
* @access private |
|
1282 |
* @return string |
|
1283 | 1283 |
*/ |
1284 | 1284 |
function EncodeHeader ($str, $position = 'text') { |
1285 | 1285 |
$x = 0; |
... | ... | |
1338 | 1338 |
|
1339 | 1339 |
/** |
1340 | 1340 |
* Checks if a string contains multibyte characters. |
1341 |
* @access private
|
|
1342 |
* @param string $str multi-byte text to wrap encode
|
|
1343 |
* @return bool
|
|
1341 |
* @access private |
|
1342 |
* @param string $str multi-byte text to wrap encode |
|
1343 |
* @return bool |
|
1344 | 1344 |
*/ |
1345 | 1345 |
function HasMultiBytes($str) { |
1346 | 1346 |
if (function_exists('mb_strlen')) { |
... | ... | |
1354 | 1354 |
* Correctly encodes and wraps long multibyte strings for mail headers |
1355 | 1355 |
* without breaking lines within a character. |
1356 | 1356 |
* Adapted from a function by paravoid at http://uk.php.net/manual/en/function.mb-encode-mimeheader.php |
1357 |
* @access private
|
|
1358 |
* @param string $str multi-byte text to wrap encode
|
|
1359 |
* @return string
|
|
1357 |
* @access private |
|
1358 |
* @param string $str multi-byte text to wrap encode |
|
1359 |
* @return string |
|
1360 | 1360 |
*/ |
1361 | 1361 |
function Base64EncodeWrapMB($str) { |
1362 | 1362 |
$start = "=?".$this->CharSet."?B?"; |
... | ... | |
1392 | 1392 |
|
1393 | 1393 |
/** |
1394 | 1394 |
* Encode string to quoted-printable. |
1395 |
* @access private
|
|
1396 |
* @return string
|
|
1395 |
* @access private |
|
1396 |
* @return string |
|
1397 | 1397 |
*/ |
1398 | 1398 |
function EncodeQP( $input = '', $line_max = 76, $space_conv = false ) { |
1399 | 1399 |
$hex = array('0','1','2','3','4','5','6','7','8','9','A','B','C','D','E','F'); |
... | ... | |
1438 | 1438 |
|
1439 | 1439 |
/** |
1440 | 1440 |
* Encode string to q encoding. |
1441 |
* @access private
|
|
1442 |
* @return string
|
|
1441 |
* @access private |
|
1442 |
* @return string |
|
1443 | 1443 |
*/ |
1444 | 1444 |
function EncodeQ ($str, $position = 'text') { |
1445 | 1445 |
/* There should not be any EOL in the string */ |
... | ... | |
1469 | 1469 |
* Adds a string or binary attachment (non-filesystem) to the list. |
1470 | 1470 |
* This method can be used to attach ascii or binary data, |
1471 | 1471 |
* such as a BLOB record from a database. |
1472 |
* @param string $string String attachment data.
|
|
1473 |
* @param string $filename Name of the attachment.
|
|
1474 |
* @param string $encoding File encoding (see $Encoding).
|
|
1475 |
* @param string $type File extension (MIME) type.
|
|
1476 |
* @return void
|
|
1472 |
* @param string $string String attachment data. |
|
1473 |
* @param string $filename Name of the attachment. |
|
1474 |
* @param string $encoding File encoding (see $Encoding). |
|
1475 |
* @param string $type File extension (MIME) type. |
|
1476 |
* @return void |
|
1477 | 1477 |
*/ |
1478 | 1478 |
function AddStringAttachment($string, $filename, $encoding = 'base64', $type = 'application/octet-stream') { |
1479 | 1479 |
/* Append to $attachment array */ |
... | ... | |
1493 | 1493 |
* just about any other document. Make sure to set the $type to an |
1494 | 1494 |
* image type. For JPEG images use "image/jpeg" and for GIF images |
1495 | 1495 |
* use "image/gif". |
1496 |
* @param string $path Path to the attachment.
|
|
1497 |
* @param string $cid Content ID of the attachment. Use this to identify
|
|
1496 |
* @param string $path Path to the attachment. |
|
1497 |
* @param string $cid Content ID of the attachment. Use this to identify |
|
1498 | 1498 |
* the Id for accessing the image in an HTML form. |
1499 |
* @param string $name Overrides the attachment name.
|
|
1500 |
* @param string $encoding File encoding (see $Encoding).
|
|
1501 |
* @param string $type File extension (MIME) type.
|
|
1502 |
* @return bool
|
|
1499 |
* @param string $name Overrides the attachment name. |
|
1500 |
* @param string $encoding File encoding (see $Encoding). |
|
1501 |
* @param string $type File extension (MIME) type. |
|
1502 |
* @return bool |
|
1503 | 1503 |
*/ |
1504 | 1504 |
function AddEmbeddedImage($path, $cid, $name = '', $encoding = 'base64', $type = 'application/octet-stream') { |
1505 | 1505 |
|
... | ... | |
1529 | 1529 |
|
1530 | 1530 |
/** |
1531 | 1531 |
* Returns true if an inline attachment is present. |
1532 |
* @access private
|
|
1533 |
* @return bool
|
|
1532 |
* @access private |
|
1533 |
* @return bool |
|
1534 | 1534 |
*/ |
1535 | 1535 |
function InlineImageExists() { |
1536 | 1536 |
$result = false; |
... | ... | |
1550 | 1550 |
|
1551 | 1551 |
/** |
1552 | 1552 |
* Clears all recipients assigned in the TO array. Returns void. |
1553 |
* @return void
|
|
1553 |
* @return void |
|
1554 | 1554 |
*/ |
1555 | 1555 |
function ClearAddresses() { |
1556 | 1556 |
$this->to = array(); |
... | ... | |
1558 | 1558 |
|
1559 | 1559 |
/** |
1560 | 1560 |
* Clears all recipients assigned in the CC array. Returns void. |
1561 |
* @return void
|
|
1561 |
* @return void |
|
1562 | 1562 |
*/ |
1563 | 1563 |
function ClearCCs() { |
1564 | 1564 |
$this->cc = array(); |
... | ... | |
1566 | 1566 |
|
1567 | 1567 |
/** |
1568 | 1568 |
* Clears all recipients assigned in the BCC array. Returns void. |
1569 |
* @return void
|
|
1569 |
* @return void |
|
1570 | 1570 |
*/ |
1571 | 1571 |
function ClearBCCs() { |
1572 | 1572 |
$this->bcc = array(); |
... | ... | |
1574 | 1574 |
|
1575 | 1575 |
/** |
1576 | 1576 |
* Clears all recipients assigned in the ReplyTo array. Returns void. |
1577 |
* @return void
|
|
1577 |
* @return void |
|
1578 | 1578 |
*/ |
1579 | 1579 |
function ClearReplyTos() { |
1580 | 1580 |
$this->ReplyTo = array(); |
... | ... | |
1583 | 1583 |
/** |
1584 | 1584 |
* Clears all recipients assigned in the TO, CC and BCC |
1585 | 1585 |
* array. Returns void. |
1586 |
* @return void
|
|
1586 |
* @return void |
|
1587 | 1587 |
*/ |
1588 | 1588 |
function ClearAllRecipients() { |
1589 | 1589 |
$this->to = array(); |
... | ... | |
1594 | 1594 |
/** |
1595 | 1595 |
* Clears all previously set filesystem, string, and binary |
1596 | 1596 |
* attachments. Returns void. |
1597 |
* @return void
|
|
1597 |
* @return void |
|
1598 | 1598 |
*/ |
1599 | 1599 |
function ClearAttachments() { |
1600 | 1600 |
$this->attachment = array(); |
... | ... | |
1602 | 1602 |
|
1603 | 1603 |
/** |
1604 | 1604 |
* Clears all custom headers. Returns void. |
1605 |
* @return void
|
|
1605 |
* @return void |
|
1606 | 1606 |
*/ |
1607 | 1607 |
function ClearCustomHeaders() { |
1608 | 1608 |
$this->CustomHeader = array(); |
... | ... | |
1615 | 1615 |
/** |
1616 | 1616 |
* Adds the error message to the error container. |
1617 | 1617 |
* Returns void. |
1618 |
* @access private
|
|
1619 |
* @return void
|
|
1618 |
* @access private |
|
1619 |
* @return void |
|
1620 | 1620 |
*/ |
1621 | 1621 |
function SetError($msg) { |
1622 | 1622 |
$this->error_count++; |
... | ... | |
1625 | 1625 |
|
1626 | 1626 |
/** |
1627 | 1627 |
* Returns the proper RFC 822 formatted date. |
1628 |
* @access private
|
|
1629 |
* @return string
|
|
1628 |
* @access private |
|
1629 |
* @return string |
|
1630 | 1630 |
*/ |
1631 | 1631 |
function RFCDate() { |
1632 | 1632 |
$tz = date('Z'); |
... | ... | |
1642 | 1642 |
* Returns the appropriate server variable. Should work with both |
1643 | 1643 |
* PHP 4.1.0+ as well as older versions. Returns an empty string |
1644 | 1644 |
* if nothing is found. |
1645 |
* @access private
|
|
1646 |
* @return mixed
|
|
1645 |
* @access private |
|
1646 |
* @return mixed |
|
1647 | 1647 |
*/ |
1648 | 1648 |
function ServerVar($varName) { |
1649 | 1649 |
global $HTTP_SERVER_VARS; |
... | ... | |
1665 | 1665 |
|
1666 | 1666 |
/** |
1667 | 1667 |
* Returns the server hostname or 'localhost.localdomain' if unknown. |
1668 |
* @access private
|
|
1669 |
* @return string
|
|
1668 |
* @access private |
|
1669 |
* @return string |
|
1670 | 1670 |
*/ |
1671 | 1671 |
function ServerHostname() { |
1672 | 1672 |
if ($this->Hostname != '') { |
... | ... | |
1682 | 1682 |
|
1683 | 1683 |
/** |
1684 | 1684 |
* Returns a message in the appropriate language. |
1685 |
* @access private
|
|
1686 |
* @return string
|
|
1685 |
* @access private |
|
1686 |
* @return string |
|
1687 | 1687 |
*/ |
1688 | 1688 |
function Lang($key) { |
1689 | 1689 |
if(count($this->language) < 1) { |
... | ... | |
1699 | 1699 |
|
1700 | 1700 |
/** |
1701 | 1701 |
* Returns true if an error occurred. |
1702 |
* @return bool
|
|
1702 |
* @return bool |
|
1703 | 1703 |
*/ |
1704 | 1704 |
function IsError() { |
1705 | 1705 |
return ($this->error_count > 0); |
... | ... | |
1707 | 1707 |
|
1708 | 1708 |
/** |
1709 | 1709 |
* Changes every end of line from CR or LF to CRLF. |
1710 |
* @access private
|
|
1711 |
* @return string
|
|
1710 |
* @access private |
|
1711 |
* @return string |
|
1712 | 1712 |
*/ |
1713 | 1713 |
function FixEOL($str) { |
1714 | 1714 |
$str = str_replace("\r\n", "\n", $str); |
... | ... | |
1719 | 1719 |
|
1720 | 1720 |
/** |
1721 | 1721 |
* Adds a custom header. |
1722 |
* @return void
|
|
1722 |
* @return void |
|
1723 | 1723 |
*/ |
1724 | 1724 |
function AddCustomHeader($custom_header) { |
1725 | 1725 |
$this->CustomHeader[] = explode(':', $custom_header, 2); |
... | ... | |
1727 | 1727 |
|
1728 | 1728 |
/** |
1729 | 1729 |
* Evaluates the message and returns modifications for inline images and backgrounds |
1730 |
* @access public
|
|
1731 |
* @return $message
|
|
1730 |
* @access public |
|
1731 |
* @return $message |
|
1732 | 1732 |
*/ |
1733 | 1733 |
function MsgHTML($message,$basedir='') { |
1734 | 1734 |
preg_match_all("/(src|background)=\"(.*)\"/Ui", $message, $images); |
... | ... | |
1764 | 1764 |
|
1765 | 1765 |
/** |
1766 | 1766 |
* Gets the mime type of the embedded or inline image |
1767 |
* @access private
|
|
1768 |
* @return mime type of ext
|
|
1767 |
* @access private |
|
1768 |
* @return mime type of ext |
|
1769 | 1769 |
*/ |
1770 | 1770 |
function _mime_types($ext = '') { |
1771 | 1771 |
$mimes = array( |
... | ... | |
1865 | 1865 |
* Usage Example: |
1866 | 1866 |
* $page->set('X-Priority', '3'); |
1867 | 1867 |
* |
1868 |
* @access public
|
|
1869 |
* @param string $name Parameter Name
|
|
1870 |
* @param mixed $value Parameter Value
|
|
1868 |
* @access public |
|
1869 |
* @param string $name Parameter Name |
|
1870 |
* @param mixed $value Parameter Value |
|
1871 | 1871 |
* NOTE: will not work with arrays, there are no arrays to set/reset |
1872 | 1872 |
*/ |
1873 | 1873 |
function set ( $name, $value = '' ) { |
... | ... | |
1882 | 1882 |
/** |
1883 | 1883 |
* Read a file from a supplied filename and return it. |
1884 | 1884 |
* |
1885 |
* @access public
|
|
1886 |
* @param string $filename Parameter File Name
|
|
1885 |
* @access public |
|
1886 |
* @param string $filename Parameter File Name |
|
1887 | 1887 |
*/ |
1888 | 1888 |
function getFile($filename) { |
1889 | 1889 |
$return = ''; |
... | ... | |
1900 | 1900 |
|
1901 | 1901 |
/** |
1902 | 1902 |
* Strips newlines to prevent header injection. |
1903 |
* @access private
|
|
1904 |
* @param string $str String
|
|
1905 |
* @return string
|
|
1903 |
* @access private |
|
1904 |
* @param string $str String |
|
1905 |
* @return string |
|
1906 | 1906 |
*/ |
1907 | 1907 |
function SecureHeader($str) { |
1908 | 1908 |
$str = trim($str); |
... | ... | |
1914 | 1914 |
/** |
1915 | 1915 |
* Set the private key file and password to sign the message. |
1916 | 1916 |
* |
1917 |
* @access public
|
|
1918 |
* @param string $key_filename Parameter File Name
|
|
1919 |
* @param string $key_pass Password for private key
|
|
1917 |
* @access public |
|
1918 |
* @param string $key_filename Parameter File Name |
|
1919 |
* @param string $key_pass Password for private key |
|
1920 | 1920 |
*/ |
1921 | 1921 |
function Sign($cert_filename, $key_filename, $key_pass) { |
1922 | 1922 |
$this->sign_cert_file = $cert_filename; |
Also available in: Unified diff
fixed headerinfos