summaryrefslogtreecommitdiff
path: root/roundcubemail/program/steps/mail/sendmail.inc
diff options
context:
space:
mode:
authorestadtherr <estadtherr@208e9e7b-5314-0410-a742-e7e81cd9613c>2007-12-11 04:20:01 +0000
committerestadtherr <estadtherr@208e9e7b-5314-0410-a742-e7e81cd9613c>2007-12-11 04:20:01 +0000
commitf667be8b4337909cfcaaf0901e1ef7d19580b716 (patch)
tree5a453f2411740871da3b4e51b5ef6fe569079361 /roundcubemail/program/steps/mail/sendmail.inc
parenta7aaf57b0c34311ceb8a5cf7a4b0b9fd11042f91 (diff)
added ability to insert attached images in HTML editor
git-svn-id: https://svn.roundcube.net/trunk@940 208e9e7b-5314-0410-a742-e7e81cd9613c
Diffstat (limited to 'roundcubemail/program/steps/mail/sendmail.inc')
-rw-r--r--roundcubemail/program/steps/mail/sendmail.inc18
1 files changed, 15 insertions, 3 deletions
diff --git a/roundcubemail/program/steps/mail/sendmail.inc b/roundcubemail/program/steps/mail/sendmail.inc
index 6f4744db9..c2f9ff7b6 100644
--- a/roundcubemail/program/steps/mail/sendmail.inc
+++ b/roundcubemail/program/steps/mail/sendmail.inc
@@ -248,8 +248,21 @@ else
// 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']))
@@ -382,5 +395,4 @@ else
$OUTPUT->send('iframe');
}
-
?>