diff options
-rw-r--r-- | lib/private/Mail/Message.php | 17 | ||||
-rw-r--r-- | 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($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 createAttachment() { - return new Attachment(\Swift_Attachment::newInstance()); + 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 |