From dcb322a6b330b7bd797f8a9faf63114129c56f75 Mon Sep 17 00:00:00 2001 From: Joas Schilling Date: Thu, 19 Oct 2017 11:05:47 +0200 Subject: [PATCH] Extend the API with teh parameters from Swift Signed-off-by: Joas Schilling --- lib/private/Mail/Message.php | 17 +++++++++++++++-- lib/public/Mail/IMessage.php | 13 ++++++++++++- 2 files changed, 27 insertions(+), 3 deletions(-) diff --git a/lib/private/Mail/Message.php b/lib/private/Mail/Message.php index 35c2c2d84ea..7b198e91b36 100644 --- a/lib/private/Mail/Message.php +++ b/lib/private/Mail/Message.php @@ -45,11 +45,24 @@ class Message implements IMessage { } /** + * @param string $data + * @param string $filename + * @param string $contentType * @return IAttachment * @since 13.0.0 */ - public function createAttachment() { - return new Attachment(\Swift_Attachment::newInstance()); + public function createAttachment($data = null, $filename = null, $contentType = null) { + return new Attachment(\Swift_Attachment::newInstance($data, $filename, $contentType)); + } + + /** + * @param string $path + * @param string $contentType + * @return IAttachment + * @since 13.0.0 + */ + public function createAttachmentFromPath($path, $contentType = null) { + return new Attachment(\Swift_Attachment::fromPath($path, $contentType)); } /** diff --git a/lib/public/Mail/IMessage.php b/lib/public/Mail/IMessage.php index 7f061cece05..6ae50ca8842 100644 --- a/lib/public/Mail/IMessage.php +++ b/lib/public/Mail/IMessage.php @@ -30,10 +30,21 @@ namespace OCP\Mail; interface IMessage { /** + * @param string $data + * @param string $filename + * @param string $contentType * @return IAttachment * @since 13.0.0 */ - public function createAttachment(); + public function createAttachment($data = null, $filename = null, $contentType = null); + + /** + * @param string $path + * @param string $contentType + * @return IAttachment + * @since 13.0.0 + */ + public function createAttachmentFromPath($path, $contentType = null); /** * @param IAttachment $attachment