Edit File by line

Deprecated: str_replace(): Passing null to parameter #2 ($replace) of type array|string is deprecated in /home/sportsfever/public_html/filemanger/function.php on line 93

Warning: Undefined array key "page_file_edit_line" in /home/sportsfever/public_html/filemanger/edit_text_line.php on line 32
/home/sportsfe.../httpdocs/clone/wp-inclu.../PHPMaile...
File: PHPMailer.php
public function wrapText($message, $length, $qp_mode = false)
[2500] Fix | Delete
{
[2501] Fix | Delete
if ($qp_mode) {
[2502] Fix | Delete
$soft_break = sprintf(' =%s', static::$LE);
[2503] Fix | Delete
} else {
[2504] Fix | Delete
$soft_break = static::$LE;
[2505] Fix | Delete
}
[2506] Fix | Delete
//If utf-8 encoding is used, we will need to make sure we don't
[2507] Fix | Delete
//split multibyte characters when we wrap
[2508] Fix | Delete
$is_utf8 = static::CHARSET_UTF8 === strtolower($this->CharSet);
[2509] Fix | Delete
$lelen = strlen(static::$LE);
[2510] Fix | Delete
$crlflen = strlen(static::$LE);
[2511] Fix | Delete
[2512] Fix | Delete
$message = static::normalizeBreaks($message);
[2513] Fix | Delete
//Remove a trailing line break
[2514] Fix | Delete
if (substr($message, -$lelen) === static::$LE) {
[2515] Fix | Delete
$message = substr($message, 0, -$lelen);
[2516] Fix | Delete
}
[2517] Fix | Delete
[2518] Fix | Delete
//Split message into lines
[2519] Fix | Delete
$lines = explode(static::$LE, $message);
[2520] Fix | Delete
//Message will be rebuilt in here
[2521] Fix | Delete
$message = '';
[2522] Fix | Delete
foreach ($lines as $line) {
[2523] Fix | Delete
$words = explode(' ', $line);
[2524] Fix | Delete
$buf = '';
[2525] Fix | Delete
$firstword = true;
[2526] Fix | Delete
foreach ($words as $word) {
[2527] Fix | Delete
if ($qp_mode && (strlen($word) > $length)) {
[2528] Fix | Delete
$space_left = $length - strlen($buf) - $crlflen;
[2529] Fix | Delete
if (!$firstword) {
[2530] Fix | Delete
if ($space_left > 20) {
[2531] Fix | Delete
$len = $space_left;
[2532] Fix | Delete
if ($is_utf8) {
[2533] Fix | Delete
$len = $this->utf8CharBoundary($word, $len);
[2534] Fix | Delete
} elseif ('=' === substr($word, $len - 1, 1)) {
[2535] Fix | Delete
--$len;
[2536] Fix | Delete
} elseif ('=' === substr($word, $len - 2, 1)) {
[2537] Fix | Delete
$len -= 2;
[2538] Fix | Delete
}
[2539] Fix | Delete
$part = substr($word, 0, $len);
[2540] Fix | Delete
$word = substr($word, $len);
[2541] Fix | Delete
$buf .= ' ' . $part;
[2542] Fix | Delete
$message .= $buf . sprintf('=%s', static::$LE);
[2543] Fix | Delete
} else {
[2544] Fix | Delete
$message .= $buf . $soft_break;
[2545] Fix | Delete
}
[2546] Fix | Delete
$buf = '';
[2547] Fix | Delete
}
[2548] Fix | Delete
while ($word !== '') {
[2549] Fix | Delete
if ($length <= 0) {
[2550] Fix | Delete
break;
[2551] Fix | Delete
}
[2552] Fix | Delete
$len = $length;
[2553] Fix | Delete
if ($is_utf8) {
[2554] Fix | Delete
$len = $this->utf8CharBoundary($word, $len);
[2555] Fix | Delete
} elseif ('=' === substr($word, $len - 1, 1)) {
[2556] Fix | Delete
--$len;
[2557] Fix | Delete
} elseif ('=' === substr($word, $len - 2, 1)) {
[2558] Fix | Delete
$len -= 2;
[2559] Fix | Delete
}
[2560] Fix | Delete
$part = substr($word, 0, $len);
[2561] Fix | Delete
$word = (string) substr($word, $len);
[2562] Fix | Delete
[2563] Fix | Delete
if ($word !== '') {
[2564] Fix | Delete
$message .= $part . sprintf('=%s', static::$LE);
[2565] Fix | Delete
} else {
[2566] Fix | Delete
$buf = $part;
[2567] Fix | Delete
}
[2568] Fix | Delete
}
[2569] Fix | Delete
} else {
[2570] Fix | Delete
$buf_o = $buf;
[2571] Fix | Delete
if (!$firstword) {
[2572] Fix | Delete
$buf .= ' ';
[2573] Fix | Delete
}
[2574] Fix | Delete
$buf .= $word;
[2575] Fix | Delete
[2576] Fix | Delete
if ('' !== $buf_o && strlen($buf) > $length) {
[2577] Fix | Delete
$message .= $buf_o . $soft_break;
[2578] Fix | Delete
$buf = $word;
[2579] Fix | Delete
}
[2580] Fix | Delete
}
[2581] Fix | Delete
$firstword = false;
[2582] Fix | Delete
}
[2583] Fix | Delete
$message .= $buf . static::$LE;
[2584] Fix | Delete
}
[2585] Fix | Delete
[2586] Fix | Delete
return $message;
[2587] Fix | Delete
}
[2588] Fix | Delete
[2589] Fix | Delete
/**
[2590] Fix | Delete
* Find the last character boundary prior to $maxLength in a utf-8
[2591] Fix | Delete
* quoted-printable encoded string.
[2592] Fix | Delete
* Original written by Colin Brown.
[2593] Fix | Delete
*
[2594] Fix | Delete
* @param string $encodedText utf-8 QP text
[2595] Fix | Delete
* @param int $maxLength Find the last character boundary prior to this length
[2596] Fix | Delete
*
[2597] Fix | Delete
* @return int
[2598] Fix | Delete
*/
[2599] Fix | Delete
public function utf8CharBoundary($encodedText, $maxLength)
[2600] Fix | Delete
{
[2601] Fix | Delete
$foundSplitPos = false;
[2602] Fix | Delete
$lookBack = 3;
[2603] Fix | Delete
while (!$foundSplitPos) {
[2604] Fix | Delete
$lastChunk = substr($encodedText, $maxLength - $lookBack, $lookBack);
[2605] Fix | Delete
$encodedCharPos = strpos($lastChunk, '=');
[2606] Fix | Delete
if (false !== $encodedCharPos) {
[2607] Fix | Delete
//Found start of encoded character byte within $lookBack block.
[2608] Fix | Delete
//Check the encoded byte value (the 2 chars after the '=')
[2609] Fix | Delete
$hex = substr($encodedText, $maxLength - $lookBack + $encodedCharPos + 1, 2);
[2610] Fix | Delete
$dec = hexdec($hex);
[2611] Fix | Delete
if ($dec < 128) {
[2612] Fix | Delete
//Single byte character.
[2613] Fix | Delete
//If the encoded char was found at pos 0, it will fit
[2614] Fix | Delete
//otherwise reduce maxLength to start of the encoded char
[2615] Fix | Delete
if ($encodedCharPos > 0) {
[2616] Fix | Delete
$maxLength -= $lookBack - $encodedCharPos;
[2617] Fix | Delete
}
[2618] Fix | Delete
$foundSplitPos = true;
[2619] Fix | Delete
} elseif ($dec >= 192) {
[2620] Fix | Delete
//First byte of a multi byte character
[2621] Fix | Delete
//Reduce maxLength to split at start of character
[2622] Fix | Delete
$maxLength -= $lookBack - $encodedCharPos;
[2623] Fix | Delete
$foundSplitPos = true;
[2624] Fix | Delete
} elseif ($dec < 192) {
[2625] Fix | Delete
//Middle byte of a multi byte character, look further back
[2626] Fix | Delete
$lookBack += 3;
[2627] Fix | Delete
}
[2628] Fix | Delete
} else {
[2629] Fix | Delete
//No encoded character found
[2630] Fix | Delete
$foundSplitPos = true;
[2631] Fix | Delete
}
[2632] Fix | Delete
}
[2633] Fix | Delete
[2634] Fix | Delete
return $maxLength;
[2635] Fix | Delete
}
[2636] Fix | Delete
[2637] Fix | Delete
/**
[2638] Fix | Delete
* Apply word wrapping to the message body.
[2639] Fix | Delete
* Wraps the message body to the number of chars set in the WordWrap property.
[2640] Fix | Delete
* You should only do this to plain-text bodies as wrapping HTML tags may break them.
[2641] Fix | Delete
* This is called automatically by createBody(), so you don't need to call it yourself.
[2642] Fix | Delete
*/
[2643] Fix | Delete
public function setWordWrap()
[2644] Fix | Delete
{
[2645] Fix | Delete
if ($this->WordWrap < 1) {
[2646] Fix | Delete
return;
[2647] Fix | Delete
}
[2648] Fix | Delete
[2649] Fix | Delete
switch ($this->message_type) {
[2650] Fix | Delete
case 'alt':
[2651] Fix | Delete
case 'alt_inline':
[2652] Fix | Delete
case 'alt_attach':
[2653] Fix | Delete
case 'alt_inline_attach':
[2654] Fix | Delete
$this->AltBody = $this->wrapText($this->AltBody, $this->WordWrap);
[2655] Fix | Delete
break;
[2656] Fix | Delete
default:
[2657] Fix | Delete
$this->Body = $this->wrapText($this->Body, $this->WordWrap);
[2658] Fix | Delete
break;
[2659] Fix | Delete
}
[2660] Fix | Delete
}
[2661] Fix | Delete
[2662] Fix | Delete
/**
[2663] Fix | Delete
* Assemble message headers.
[2664] Fix | Delete
*
[2665] Fix | Delete
* @return string The assembled headers
[2666] Fix | Delete
*/
[2667] Fix | Delete
public function createHeader()
[2668] Fix | Delete
{
[2669] Fix | Delete
$result = '';
[2670] Fix | Delete
[2671] Fix | Delete
$result .= $this->headerLine('Date', '' === $this->MessageDate ? self::rfcDate() : $this->MessageDate);
[2672] Fix | Delete
[2673] Fix | Delete
//The To header is created automatically by mail(), so needs to be omitted here
[2674] Fix | Delete
if ('mail' !== $this->Mailer) {
[2675] Fix | Delete
if ($this->SingleTo) {
[2676] Fix | Delete
foreach ($this->to as $toaddr) {
[2677] Fix | Delete
$this->SingleToArray[] = $this->addrFormat($toaddr);
[2678] Fix | Delete
}
[2679] Fix | Delete
} elseif (count($this->to) > 0) {
[2680] Fix | Delete
$result .= $this->addrAppend('To', $this->to);
[2681] Fix | Delete
} elseif (count($this->cc) === 0) {
[2682] Fix | Delete
$result .= $this->headerLine('To', 'undisclosed-recipients:;');
[2683] Fix | Delete
}
[2684] Fix | Delete
}
[2685] Fix | Delete
$result .= $this->addrAppend('From', [[trim($this->From), $this->FromName]]);
[2686] Fix | Delete
[2687] Fix | Delete
//sendmail and mail() extract Cc from the header before sending
[2688] Fix | Delete
if (count($this->cc) > 0) {
[2689] Fix | Delete
$result .= $this->addrAppend('Cc', $this->cc);
[2690] Fix | Delete
}
[2691] Fix | Delete
[2692] Fix | Delete
//sendmail and mail() extract Bcc from the header before sending
[2693] Fix | Delete
if (
[2694] Fix | Delete
(
[2695] Fix | Delete
'sendmail' === $this->Mailer || 'qmail' === $this->Mailer || 'mail' === $this->Mailer
[2696] Fix | Delete
)
[2697] Fix | Delete
&& count($this->bcc) > 0
[2698] Fix | Delete
) {
[2699] Fix | Delete
$result .= $this->addrAppend('Bcc', $this->bcc);
[2700] Fix | Delete
}
[2701] Fix | Delete
[2702] Fix | Delete
if (count($this->ReplyTo) > 0) {
[2703] Fix | Delete
$result .= $this->addrAppend('Reply-To', $this->ReplyTo);
[2704] Fix | Delete
}
[2705] Fix | Delete
[2706] Fix | Delete
//mail() sets the subject itself
[2707] Fix | Delete
if ('mail' !== $this->Mailer) {
[2708] Fix | Delete
$result .= $this->headerLine('Subject', $this->encodeHeader($this->secureHeader($this->Subject)));
[2709] Fix | Delete
}
[2710] Fix | Delete
[2711] Fix | Delete
//Only allow a custom message ID if it conforms to RFC 5322 section 3.6.4
[2712] Fix | Delete
//https://tools.ietf.org/html/rfc5322#section-3.6.4
[2713] Fix | Delete
if (
[2714] Fix | Delete
'' !== $this->MessageID &&
[2715] Fix | Delete
preg_match(
[2716] Fix | Delete
'/^<((([a-z\d!#$%&\'*+\/=?^_`{|}~-]+(\.[a-z\d!#$%&\'*+\/=?^_`{|}~-]+)*)' .
[2717] Fix | Delete
'|("(([\x01-\x08\x0B\x0C\x0E-\x1F\x7F]|[\x21\x23-\x5B\x5D-\x7E])' .
[2718] Fix | Delete
'|(\\[\x01-\x09\x0B\x0C\x0E-\x7F]))*"))@(([a-z\d!#$%&\'*+\/=?^_`{|}~-]+' .
[2719] Fix | Delete
'(\.[a-z\d!#$%&\'*+\/=?^_`{|}~-]+)*)|(\[(([\x01-\x08\x0B\x0C\x0E-\x1F\x7F]' .
[2720] Fix | Delete
'|[\x21-\x5A\x5E-\x7E])|(\\[\x01-\x09\x0B\x0C\x0E-\x7F]))*\])))>$/Di',
[2721] Fix | Delete
$this->MessageID
[2722] Fix | Delete
)
[2723] Fix | Delete
) {
[2724] Fix | Delete
$this->lastMessageID = $this->MessageID;
[2725] Fix | Delete
} else {
[2726] Fix | Delete
$this->lastMessageID = sprintf('<%s@%s>', $this->uniqueid, $this->serverHostname());
[2727] Fix | Delete
}
[2728] Fix | Delete
$result .= $this->headerLine('Message-ID', $this->lastMessageID);
[2729] Fix | Delete
if (null !== $this->Priority) {
[2730] Fix | Delete
$result .= $this->headerLine('X-Priority', $this->Priority);
[2731] Fix | Delete
}
[2732] Fix | Delete
if ('' === $this->XMailer) {
[2733] Fix | Delete
//Empty string for default X-Mailer header
[2734] Fix | Delete
$result .= $this->headerLine(
[2735] Fix | Delete
'X-Mailer',
[2736] Fix | Delete
'PHPMailer ' . self::VERSION . ' (https://github.com/PHPMailer/PHPMailer)'
[2737] Fix | Delete
);
[2738] Fix | Delete
} elseif (is_string($this->XMailer) && trim($this->XMailer) !== '') {
[2739] Fix | Delete
//Some string
[2740] Fix | Delete
$result .= $this->headerLine('X-Mailer', trim($this->XMailer));
[2741] Fix | Delete
} //Other values result in no X-Mailer header
[2742] Fix | Delete
[2743] Fix | Delete
if ('' !== $this->ConfirmReadingTo) {
[2744] Fix | Delete
$result .= $this->headerLine('Disposition-Notification-To', '<' . $this->ConfirmReadingTo . '>');
[2745] Fix | Delete
}
[2746] Fix | Delete
[2747] Fix | Delete
//Add custom headers
[2748] Fix | Delete
foreach ($this->CustomHeader as $header) {
[2749] Fix | Delete
$result .= $this->headerLine(
[2750] Fix | Delete
trim($header[0]),
[2751] Fix | Delete
$this->encodeHeader(trim($header[1]))
[2752] Fix | Delete
);
[2753] Fix | Delete
}
[2754] Fix | Delete
if (!$this->sign_key_file) {
[2755] Fix | Delete
$result .= $this->headerLine('MIME-Version', '1.0');
[2756] Fix | Delete
$result .= $this->getMailMIME();
[2757] Fix | Delete
}
[2758] Fix | Delete
[2759] Fix | Delete
return $result;
[2760] Fix | Delete
}
[2761] Fix | Delete
[2762] Fix | Delete
/**
[2763] Fix | Delete
* Get the message MIME type headers.
[2764] Fix | Delete
*
[2765] Fix | Delete
* @return string
[2766] Fix | Delete
*/
[2767] Fix | Delete
public function getMailMIME()
[2768] Fix | Delete
{
[2769] Fix | Delete
$result = '';
[2770] Fix | Delete
$ismultipart = true;
[2771] Fix | Delete
switch ($this->message_type) {
[2772] Fix | Delete
case 'inline':
[2773] Fix | Delete
$result .= $this->headerLine('Content-Type', static::CONTENT_TYPE_MULTIPART_RELATED . ';');
[2774] Fix | Delete
$result .= $this->textLine(' boundary="' . $this->boundary[1] . '"');
[2775] Fix | Delete
break;
[2776] Fix | Delete
case 'attach':
[2777] Fix | Delete
case 'inline_attach':
[2778] Fix | Delete
case 'alt_attach':
[2779] Fix | Delete
case 'alt_inline_attach':
[2780] Fix | Delete
$result .= $this->headerLine('Content-Type', static::CONTENT_TYPE_MULTIPART_MIXED . ';');
[2781] Fix | Delete
$result .= $this->textLine(' boundary="' . $this->boundary[1] . '"');
[2782] Fix | Delete
break;
[2783] Fix | Delete
case 'alt':
[2784] Fix | Delete
case 'alt_inline':
[2785] Fix | Delete
$result .= $this->headerLine('Content-Type', static::CONTENT_TYPE_MULTIPART_ALTERNATIVE . ';');
[2786] Fix | Delete
$result .= $this->textLine(' boundary="' . $this->boundary[1] . '"');
[2787] Fix | Delete
break;
[2788] Fix | Delete
default:
[2789] Fix | Delete
//Catches case 'plain': and case '':
[2790] Fix | Delete
$result .= $this->textLine('Content-Type: ' . $this->ContentType . '; charset=' . $this->CharSet);
[2791] Fix | Delete
$ismultipart = false;
[2792] Fix | Delete
break;
[2793] Fix | Delete
}
[2794] Fix | Delete
//RFC1341 part 5 says 7bit is assumed if not specified
[2795] Fix | Delete
if (static::ENCODING_7BIT !== $this->Encoding) {
[2796] Fix | Delete
//RFC 2045 section 6.4 says multipart MIME parts may only use 7bit, 8bit or binary CTE
[2797] Fix | Delete
if ($ismultipart) {
[2798] Fix | Delete
if (static::ENCODING_8BIT === $this->Encoding) {
[2799] Fix | Delete
$result .= $this->headerLine('Content-Transfer-Encoding', static::ENCODING_8BIT);
[2800] Fix | Delete
}
[2801] Fix | Delete
//The only remaining alternatives are quoted-printable and base64, which are both 7bit compatible
[2802] Fix | Delete
} else {
[2803] Fix | Delete
$result .= $this->headerLine('Content-Transfer-Encoding', $this->Encoding);
[2804] Fix | Delete
}
[2805] Fix | Delete
}
[2806] Fix | Delete
[2807] Fix | Delete
return $result;
[2808] Fix | Delete
}
[2809] Fix | Delete
[2810] Fix | Delete
/**
[2811] Fix | Delete
* Returns the whole MIME message.
[2812] Fix | Delete
* Includes complete headers and body.
[2813] Fix | Delete
* Only valid post preSend().
[2814] Fix | Delete
*
[2815] Fix | Delete
* @see PHPMailer::preSend()
[2816] Fix | Delete
*
[2817] Fix | Delete
* @return string
[2818] Fix | Delete
*/
[2819] Fix | Delete
public function getSentMIMEMessage()
[2820] Fix | Delete
{
[2821] Fix | Delete
return static::stripTrailingWSP($this->MIMEHeader . $this->mailHeader) .
[2822] Fix | Delete
static::$LE . static::$LE . $this->MIMEBody;
[2823] Fix | Delete
}
[2824] Fix | Delete
[2825] Fix | Delete
/**
[2826] Fix | Delete
* Create a unique ID to use for boundaries.
[2827] Fix | Delete
*
[2828] Fix | Delete
* @return string
[2829] Fix | Delete
*/
[2830] Fix | Delete
protected function generateId()
[2831] Fix | Delete
{
[2832] Fix | Delete
$len = 32; //32 bytes = 256 bits
[2833] Fix | Delete
$bytes = '';
[2834] Fix | Delete
if (function_exists('random_bytes')) {
[2835] Fix | Delete
try {
[2836] Fix | Delete
$bytes = random_bytes($len);
[2837] Fix | Delete
} catch (\Exception $e) {
[2838] Fix | Delete
//Do nothing
[2839] Fix | Delete
}
[2840] Fix | Delete
} elseif (function_exists('openssl_random_pseudo_bytes')) {
[2841] Fix | Delete
/** @noinspection CryptographicallySecureRandomnessInspection */
[2842] Fix | Delete
$bytes = openssl_random_pseudo_bytes($len);
[2843] Fix | Delete
}
[2844] Fix | Delete
if ($bytes === '') {
[2845] Fix | Delete
//We failed to produce a proper random string, so make do.
[2846] Fix | Delete
//Use a hash to force the length to the same as the other methods
[2847] Fix | Delete
$bytes = hash('sha256', uniqid((string) mt_rand(), true), true);
[2848] Fix | Delete
}
[2849] Fix | Delete
[2850] Fix | Delete
//We don't care about messing up base64 format here, just want a random string
[2851] Fix | Delete
return str_replace(['=', '+', '/'], '', base64_encode(hash('sha256', $bytes, true)));
[2852] Fix | Delete
}
[2853] Fix | Delete
[2854] Fix | Delete
/**
[2855] Fix | Delete
* Assemble the message body.
[2856] Fix | Delete
* Returns an empty string on failure.
[2857] Fix | Delete
*
[2858] Fix | Delete
* @throws Exception
[2859] Fix | Delete
*
[2860] Fix | Delete
* @return string The assembled message body
[2861] Fix | Delete
*/
[2862] Fix | Delete
public function createBody()
[2863] Fix | Delete
{
[2864] Fix | Delete
$body = '';
[2865] Fix | Delete
//Create unique IDs and preset boundaries
[2866] Fix | Delete
$this->setBoundaries();
[2867] Fix | Delete
[2868] Fix | Delete
if ($this->sign_key_file) {
[2869] Fix | Delete
$body .= $this->getMailMIME() . static::$LE;
[2870] Fix | Delete
}
[2871] Fix | Delete
[2872] Fix | Delete
$this->setWordWrap();
[2873] Fix | Delete
[2874] Fix | Delete
$bodyEncoding = $this->Encoding;
[2875] Fix | Delete
$bodyCharSet = $this->CharSet;
[2876] Fix | Delete
//Can we do a 7-bit downgrade?
[2877] Fix | Delete
if (static::ENCODING_8BIT === $bodyEncoding && !$this->has8bitChars($this->Body)) {
[2878] Fix | Delete
$bodyEncoding = static::ENCODING_7BIT;
[2879] Fix | Delete
//All ISO 8859, Windows codepage and UTF-8 charsets are ascii compatible up to 7-bit
[2880] Fix | Delete
$bodyCharSet = static::CHARSET_ASCII;
[2881] Fix | Delete
}
[2882] Fix | Delete
//If lines are too long, and we're not already using an encoding that will shorten them,
[2883] Fix | Delete
//change to quoted-printable transfer encoding for the body part only
[2884] Fix | Delete
if (static::ENCODING_BASE64 !== $this->Encoding && static::hasLineLongerThanMax($this->Body)) {
[2885] Fix | Delete
$bodyEncoding = static::ENCODING_QUOTED_PRINTABLE;
[2886] Fix | Delete
}
[2887] Fix | Delete
[2888] Fix | Delete
$altBodyEncoding = $this->Encoding;
[2889] Fix | Delete
$altBodyCharSet = $this->CharSet;
[2890] Fix | Delete
//Can we do a 7-bit downgrade?
[2891] Fix | Delete
if (static::ENCODING_8BIT === $altBodyEncoding && !$this->has8bitChars($this->AltBody)) {
[2892] Fix | Delete
$altBodyEncoding = static::ENCODING_7BIT;
[2893] Fix | Delete
//All ISO 8859, Windows codepage and UTF-8 charsets are ascii compatible up to 7-bit
[2894] Fix | Delete
$altBodyCharSet = static::CHARSET_ASCII;
[2895] Fix | Delete
}
[2896] Fix | Delete
//If lines are too long, and we're not already using an encoding that will shorten them,
[2897] Fix | Delete
//change to quoted-printable transfer encoding for the alt body part only
[2898] Fix | Delete
if (static::ENCODING_BASE64 !== $altBodyEncoding && static::hasLineLongerThanMax($this->AltBody)) {
[2899] Fix | Delete
$altBodyEncoding = static::ENCODING_QUOTED_PRINTABLE;
[2900] Fix | Delete
}
[2901] Fix | Delete
//Use this as a preamble in all multipart message types
[2902] Fix | Delete
$mimepre = '';
[2903] Fix | Delete
switch ($this->message_type) {
[2904] Fix | Delete
case 'inline':
[2905] Fix | Delete
$body .= $mimepre;
[2906] Fix | Delete
$body .= $this->getBoundary($this->boundary[1], $bodyCharSet, '', $bodyEncoding);
[2907] Fix | Delete
$body .= $this->encodeString($this->Body, $bodyEncoding);
[2908] Fix | Delete
$body .= static::$LE;
[2909] Fix | Delete
$body .= $this->attachAll('inline', $this->boundary[1]);
[2910] Fix | Delete
break;
[2911] Fix | Delete
case 'attach':
[2912] Fix | Delete
$body .= $mimepre;
[2913] Fix | Delete
$body .= $this->getBoundary($this->boundary[1], $bodyCharSet, '', $bodyEncoding);
[2914] Fix | Delete
$body .= $this->encodeString($this->Body, $bodyEncoding);
[2915] Fix | Delete
$body .= static::$LE;
[2916] Fix | Delete
$body .= $this->attachAll('attachment', $this->boundary[1]);
[2917] Fix | Delete
break;
[2918] Fix | Delete
case 'inline_attach':
[2919] Fix | Delete
$body .= $mimepre;
[2920] Fix | Delete
$body .= $this->textLine('--' . $this->boundary[1]);
[2921] Fix | Delete
$body .= $this->headerLine('Content-Type', static::CONTENT_TYPE_MULTIPART_RELATED . ';');
[2922] Fix | Delete
$body .= $this->textLine(' boundary="' . $this->boundary[2] . '";');
[2923] Fix | Delete
$body .= $this->textLine(' type="' . static::CONTENT_TYPE_TEXT_HTML . '"');
[2924] Fix | Delete
$body .= static::$LE;
[2925] Fix | Delete
$body .= $this->getBoundary($this->boundary[2], $bodyCharSet, '', $bodyEncoding);
[2926] Fix | Delete
$body .= $this->encodeString($this->Body, $bodyEncoding);
[2927] Fix | Delete
$body .= static::$LE;
[2928] Fix | Delete
$body .= $this->attachAll('inline', $this->boundary[2]);
[2929] Fix | Delete
$body .= static::$LE;
[2930] Fix | Delete
$body .= $this->attachAll('attachment', $this->boundary[1]);
[2931] Fix | Delete
break;
[2932] Fix | Delete
case 'alt':
[2933] Fix | Delete
$body .= $mimepre;
[2934] Fix | Delete
$body .= $this->getBoundary(
[2935] Fix | Delete
$this->boundary[1],
[2936] Fix | Delete
$altBodyCharSet,
[2937] Fix | Delete
static::CONTENT_TYPE_PLAINTEXT,
[2938] Fix | Delete
$altBodyEncoding
[2939] Fix | Delete
);
[2940] Fix | Delete
$body .= $this->encodeString($this->AltBody, $altBodyEncoding);
[2941] Fix | Delete
$body .= static::$LE;
[2942] Fix | Delete
$body .= $this->getBoundary(
[2943] Fix | Delete
$this->boundary[1],
[2944] Fix | Delete
$bodyCharSet,
[2945] Fix | Delete
static::CONTENT_TYPE_TEXT_HTML,
[2946] Fix | Delete
$bodyEncoding
[2947] Fix | Delete
);
[2948] Fix | Delete
$body .= $this->encodeString($this->Body, $bodyEncoding);
[2949] Fix | Delete
$body .= static::$LE;
[2950] Fix | Delete
if (!empty($this->Ical)) {
[2951] Fix | Delete
$method = static::ICAL_METHOD_REQUEST;
[2952] Fix | Delete
foreach (static::$IcalMethods as $imethod) {
[2953] Fix | Delete
if (stripos($this->Ical, 'METHOD:' . $imethod) !== false) {
[2954] Fix | Delete
$method = $imethod;
[2955] Fix | Delete
break;
[2956] Fix | Delete
}
[2957] Fix | Delete
}
[2958] Fix | Delete
$body .= $this->getBoundary(
[2959] Fix | Delete
$this->boundary[1],
[2960] Fix | Delete
'',
[2961] Fix | Delete
static::CONTENT_TYPE_TEXT_CALENDAR . '; method=' . $method,
[2962] Fix | Delete
''
[2963] Fix | Delete
);
[2964] Fix | Delete
$body .= $this->encodeString($this->Ical, $this->Encoding);
[2965] Fix | Delete
$body .= static::$LE;
[2966] Fix | Delete
}
[2967] Fix | Delete
$body .= $this->endBoundary($this->boundary[1]);
[2968] Fix | Delete
break;
[2969] Fix | Delete
case 'alt_inline':
[2970] Fix | Delete
$body .= $mimepre;
[2971] Fix | Delete
$body .= $this->getBoundary(
[2972] Fix | Delete
$this->boundary[1],
[2973] Fix | Delete
$altBodyCharSet,
[2974] Fix | Delete
static::CONTENT_TYPE_PLAINTEXT,
[2975] Fix | Delete
$altBodyEncoding
[2976] Fix | Delete
);
[2977] Fix | Delete
$body .= $this->encodeString($this->AltBody, $altBodyEncoding);
[2978] Fix | Delete
$body .= static::$LE;
[2979] Fix | Delete
$body .= $this->textLine('--' . $this->boundary[1]);
[2980] Fix | Delete
$body .= $this->headerLine('Content-Type', static::CONTENT_TYPE_MULTIPART_RELATED . ';');
[2981] Fix | Delete
$body .= $this->textLine(' boundary="' . $this->boundary[2] . '";');
[2982] Fix | Delete
$body .= $this->textLine(' type="' . static::CONTENT_TYPE_TEXT_HTML . '"');
[2983] Fix | Delete
$body .= static::$LE;
[2984] Fix | Delete
$body .= $this->getBoundary(
[2985] Fix | Delete
$this->boundary[2],
[2986] Fix | Delete
$bodyCharSet,
[2987] Fix | Delete
static::CONTENT_TYPE_TEXT_HTML,
[2988] Fix | Delete
$bodyEncoding
[2989] Fix | Delete
);
[2990] Fix | Delete
$body .= $this->encodeString($this->Body, $bodyEncoding);
[2991] Fix | Delete
$body .= static::$LE;
[2992] Fix | Delete
$body .= $this->attachAll('inline', $this->boundary[2]);
[2993] Fix | Delete
$body .= static::$LE;
[2994] Fix | Delete
$body .= $this->endBoundary($this->boundary[1]);
[2995] Fix | Delete
break;
[2996] Fix | Delete
case 'alt_attach':
[2997] Fix | Delete
$body .= $mimepre;
[2998] Fix | Delete
$body .= $this->textLine('--' . $this->boundary[1]);
[2999] Fix | Delete
It is recommended that you Edit text format, this type of Fix handles quite a lot in one request
Function