summaryrefslogtreecommitdiffstats
path: root/lib/private/Mail/Mailer.php
diff options
context:
space:
mode:
authorJoas Schilling <coding@schilljs.com>2017-10-25 09:26:57 +0200
committerJoas Schilling <coding@schilljs.com>2017-10-25 09:26:57 +0200
commit6a035bd0a0ea3f7a8811a2a970dcb22450fa26e0 (patch)
tree65103a2e29b0507bb830d6fcd07e4b93dbadc6ef /lib/private/Mail/Mailer.php
parent65e938c4fdbda3c88e79c83e43e7ea8a22789408 (diff)
downloadnextcloud-server-6a035bd0a0ea3f7a8811a2a970dcb22450fa26e0.tar.gz
nextcloud-server-6a035bd0a0ea3f7a8811a2a970dcb22450fa26e0.zip
Move attachment creators to mailer class
Signed-off-by: Joas Schilling <coding@schilljs.com>
Diffstat (limited to 'lib/private/Mail/Mailer.php')
-rw-r--r--lib/private/Mail/Mailer.php22
1 files changed, 22 insertions, 0 deletions
diff --git a/lib/private/Mail/Mailer.php b/lib/private/Mail/Mailer.php
index 43fdb07b810..ad59d640b3e 100644
--- a/lib/private/Mail/Mailer.php
+++ b/lib/private/Mail/Mailer.php
@@ -26,6 +26,7 @@ use OCP\Defaults;
use OCP\IConfig;
use OCP\IL10N;
use OCP\IURLGenerator;
+use OCP\Mail\IAttachment;
use OCP\Mail\IEMailTemplate;
use OCP\Mail\IMailer;
use OCP\ILogger;
@@ -92,6 +93,27 @@ class Mailer implements IMailer {
}
/**
+ * @param string|null $data
+ * @param string|null $filename
+ * @param string|null $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|null $contentType
+ * @return IAttachment
+ * @since 13.0.0
+ */
+ public function createAttachmentFromPath($path, $contentType = null) {
+ return new Attachment(\Swift_Attachment::fromPath($path, $contentType));
+ }
+
+ /**
* Creates a new email template object
*
* @param string $emailId