Move attachment creators to mailer class
Signed-off-by: Joas Schilling <coding@schilljs.com>
This commit is contained in:
parent
65e938c4fd
commit
6a035bd0a0
|
@ -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;
|
||||
|
@ -91,6 +92,27 @@ class Mailer implements IMailer {
|
|||
return new Message(new \Swift_Message());
|
||||
}
|
||||
|
||||
/**
|
||||
* @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
|
||||
*
|
||||
|
|
|
@ -44,27 +44,6 @@ class Message implements IMessage {
|
|||
$this->swiftMessage = $swiftMessage;
|
||||
}
|
||||
|
||||
/**
|
||||
* @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));
|
||||
}
|
||||
|
||||
/**
|
||||
* @param IAttachment $attachment
|
||||
* @return $this
|
||||
|
|
|
@ -53,6 +53,23 @@ interface IMailer {
|
|||
*/
|
||||
public function createMessage();
|
||||
|
||||
/**
|
||||
* @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);
|
||||
|
||||
/**
|
||||
* @param string $path
|
||||
* @param string|null $contentType
|
||||
* @return IAttachment
|
||||
* @since 13.0.0
|
||||
*/
|
||||
public function createAttachmentFromPath($path, $contentType = null);
|
||||
|
||||
/**
|
||||
* Creates a new email template object
|
||||
*
|
||||
|
|
|
@ -29,23 +29,6 @@ namespace OCP\Mail;
|
|||
*/
|
||||
interface IMessage {
|
||||
|
||||
/**
|
||||
* @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);
|
||||
|
||||
/**
|
||||
* @param string $path
|
||||
* @param string|null $contentType
|
||||
* @return IAttachment
|
||||
* @since 13.0.0
|
||||
*/
|
||||
public function createAttachmentFromPath($path, $contentType = null);
|
||||
|
||||
/**
|
||||
* @param IAttachment $attachment
|
||||
* @return $this
|
||||
|
|
Loading…
Reference in New Issue