| | |
| | | // additional headers |
| | | $headers['Message-ID'] = $message_id; |
| | | $headers['X-Sender'] = $from; |
| | | $headers['Received'] = wordwrap('from ' . |
| | | (isset($_SERVER['HTTP_X_FORWARDED_FOR']) ? |
| | | gethostbyaddr($_SERVER['HTTP_X_FORWARDED_FOR']).' ['.$_SERVER['HTTP_X_FORWARDED_FOR'].'] via ' : '') . |
| | | gethostbyaddr($_SERVER['REMOTE_ADDR']).' ['.$_SERVER['REMOTE_ADDR'].'] with ' . |
| | | $_SERVER['SERVER_PROTOCOL'].' ('.$_SERVER['REQUEST_METHOD'].'); ' . date('r'), |
| | | 69, rcmail_header_delm() . "\t"); |
| | | |
| | | if (!empty($CONFIG['useragent'])) |
| | | $headers['User-Agent'] = $CONFIG['useragent']; |
| | |
| | | // add a plain text version of the e-mail as an alternative part. |
| | | $h2t = new html2text($message_body); |
| | | $plainTextPart = wordwrap($h2t->get_text(), 998, "\r\n", true); |
| | | $MAIL_MIME->setTXTBody($plainTextPart); |
| | | $MAIL_MIME->setTXTBody(html_entity_decode($plainTextPart, ENT_COMPAT, 'utf-8')); |
| | | |
| | | // look for "emoticon" images from TinyMCE and copy into message as attachments |
| | | rcmail_attach_emoticons($MAIL_MIME); |
| | |
| | | |
| | | // add stored attachments, if any |
| | | if (is_array($_SESSION['compose']['attachments'])) |
| | | foreach ($_SESSION['compose']['attachments'] as $attachment) |
| | | $MAIL_MIME->addAttachment($attachment['path'], $attachment['mimetype'], $attachment['name'], true, 'base64', 'attachment', $message_charset); |
| | | foreach ($_SESSION['compose']['attachments'] as $id => $attachment) |
| | | { |
| | | $dispurl = '/\ssrc\s*=\s*[\'"]?\S+display-attachment\S+file=rcmfile' . $id . '[\'"]?/'; |
| | | $match = preg_match($dispurl, $message_body); |
| | | if ($isHtml && ($match > 0)) |
| | | { |
| | | $message_body = preg_replace($dispurl, ' src="'.$attachment['name'].'"', $message_body); |
| | | $MAIL_MIME->setHTMLBody($message_body); |
| | | $MAIL_MIME->addHTMLImage($attachment['path'], $attachment['mimetype'], $attachment['name']); |
| | | } |
| | | else |
| | | { |
| | | $MAIL_MIME->addAttachment($attachment['path'], $attachment['mimetype'], $attachment['name'], true, 'base64', 'attachment', $message_charset); |
| | | } |
| | | } |
| | | |
| | | // add submitted attachments |
| | | if (is_array($_FILES['_attachments']['tmp_name'])) |
| | |
| | | $OUTPUT->command('sent_successfully', rcube_label('messagesent')); |
| | | $OUTPUT->send('iframe'); |
| | | } |
| | | |
| | | |
| | | ?> |