IMailer¶
-
interface
OCP\Mail\
IMailer
¶ - Class IMailer provides some basic functions to create a mail message that can be used in combination with\OC\Mail\Message.Example usage:$mailer = \OC::$server->getMailer();$message = $mailer->createMessage();$message->setSubject(‘Your Subject’);$message->setFrom(['cloud@domain.org‘ => ‘Nextcloud Notifier’]);$message->setTo(['recipient@domain.org‘ => ‘Recipient’]);$message->setPlainBody(‘The message text’);$message->setHtmlBody(‘The <strong>message</strong> text’);$mailer->send($message);This message can then be passed to send() of \OC\Mail\Mailer
Implemented by: OC\Mail\Mailer
Source: lib/public/Mail/IMailer.php#50
Methods¶
-
public
OCP\Mail\IMailer::
createMessage
()¶ - Creates a new message object that can be passed to send()
Source: lib/public/Mail/IMailer.php#57 Returns: \OCP\Mail\IMessage
Since: 8.1.0
-
public
OCP\Mail\IMailer::
createAttachment
($data=null, $filename=null, $contentType=null)¶ Source: Parameters: - $data (string | null)
- $filename (string | null)
- $contentType (string | null)
Returns: Since: 13.0.0
-
public
OCP\Mail\IMailer::
createAttachmentFromPath
($path, $contentType=null)¶ Source: Parameters: - $path (string)
- $contentType (string | null)
Returns: Since: 13.0.0
-
public
OCP\Mail\IMailer::
createEMailTemplate
($emailId, $data=[])¶ - Creates a new email template object
Source: Parameters: - $emailId (string)
- $data (array)
Returns: Since: 12.0.0 Parameters added in 12.0.3
-
public
OCP\Mail\IMailer::
send
($message)¶ - Send the specified message. Also sets the from address to the value defined in config.phpif no-one has been passed.
Source: Parameters: - $message (
OCP\Mail\IMessage
) Message to send
Returns: string[] Array with failed recipients. Be aware that this depends on the used mail backend and therefore should be considered
Throws: \Exception
In case it was not possible to send the message. (for example if an invalid mail address has been supplied.)Since: 8.1.0
- $message (
-
public
OCP\Mail\IMailer::
validateMailAddress
($email)¶ - Checks if an e-mail address is valid
Source: Parameters: - $email (string) Email address to be validated
Returns: bool True if the mail address is valid, false otherwise
Since: 8.1.0