summaryrefslogtreecommitdiffstats
path: root/lib
diff options
context:
space:
mode:
authorAnna <anna@nextcloud.com>2023-05-10 12:10:42 +0200
committerGitHub <noreply@github.com>2023-05-10 12:10:42 +0200
commit9e53934498ba40b120c27a5ff171740aeb1c8a57 (patch)
treefe8fe1530a116fe46684d9379f04ca6d3ed14f5a /lib
parent14cb58c0e5b4507704755a462a859c407173c21f (diff)
parented708150760505cb3571c9f6fd257d1485f71eb7 (diff)
downloadnextcloud-server-9e53934498ba40b120c27a5ff171740aeb1c8a57.tar.gz
nextcloud-server-9e53934498ba40b120c27a5ff171740aeb1c8a57.zip
Merge pull request #36118 from nextcloud/fix/caldav/invitation-outlook-compatibilty
Fix calendar emails to be outlook compatible
Diffstat (limited to 'lib')
-rw-r--r--lib/private/Mail/Message.php16
-rw-r--r--lib/public/Mail/IMessage.php12
2 files changed, 28 insertions, 0 deletions
diff --git a/lib/private/Mail/Message.php b/lib/private/Mail/Message.php
index 01beefcc6d6..35d6f96d33a 100644
--- a/lib/private/Mail/Message.php
+++ b/lib/private/Mail/Message.php
@@ -76,6 +76,22 @@ class Message implements IMessage {
}
/**
+ * Can be used to "attach content inline" as message parts with specific MIME type and encoding.
+ * {@inheritDoc}
+ * @since 26.0.0
+ */
+ public function attachInline(string $body, string $name, string $contentType = null): IMessage {
+ # To be sure this works with iCalendar messages, we encode with 8bit instead of
+ # quoted-printable encoding. We save the current encoder, replace the current
+ # encoder with an 8bit encoder and after we've finished, we reset the encoder
+ # to the previous one. Originally intended to be added after the message body,
+ # as it is curently unknown if all mail clients handle this properly if added
+ # before.
+ $this->symfonyEmail->embed($body, $name, $contentType);
+ return $this;
+ }
+
+ /**
* Converts the [['displayName' => 'email'], ['displayName2' => 'email2']] arrays to valid Adresses
*
* @param array $addresses Array of mail addresses
diff --git a/lib/public/Mail/IMessage.php b/lib/public/Mail/IMessage.php
index 35a67bc4bb8..b3cc86839f1 100644
--- a/lib/public/Mail/IMessage.php
+++ b/lib/public/Mail/IMessage.php
@@ -40,6 +40,18 @@ interface IMessage {
public function attach(IAttachment $attachment): IMessage;
/**
+ * Can be used to "attach content inline" as message parts with specific MIME type and encoding.
+ *
+ * @param string $body body of the MIME part
+ * @param string $name the file name
+ * @param string|null $contentType MIME Content-Type (e.g. text/plain or text/calendar)
+ *
+ * @return IMessage
+ * @since 26.0.0
+ */
+ public function attachInline(string $body, string $name, string $contentType = null): IMessage;
+
+ /**
* Set the from address of this message.
*
* If no "From" address is used \OC\Mail\Mailer will use mail_from_address and mail_domain from config.php