Class humhub\components\mail\Mailer

Inheritancehumhub\components\mail\Mailer » yii\swiftmailer\Mailer
Available since version1.2

Mailer implements a mailer based on SwiftMailer.

See also \yii\swiftmailer\Mailer.

Public Properties

Hide inherited properties

PropertyTypeDescriptionDefined By
$messageClass humhub\components\mail\Mailer
$signingCertificatePath string|null Path for the sigining certificate. humhub\components\mail\Mailer
$signingExtraCertsPath string|null Path for extra sigining certificates (i.e. intermidiate certificates). humhub\components\mail\Mailer
$signingOptions integer Bitwise operator options for openssl_pkcs7_sign() humhub\components\mail\Mailer
$signingPrivateKeyPath string|null Path for the sigining certificate private key. humhub\components\mail\Mailer
$surpressedRecipients array Of surpressed recipient e-mail addresses humhub\components\mail\Mailer

Public Methods

Hide inherited methods

MethodDescriptionDefined By
compose() Creates a new message instance and optionally composes its body content via view rendering. humhub\components\mail\Mailer
isRecipientSurpressed() Checks if an given e-mail address is surpressed. humhub\components\mail\Mailer
sendMessage() humhub\components\mail\Mailer

Property Details

$messageClass public property
public $messageClass 'humhub\components\mail\Message'
$signingCertificatePath public property

Path for the sigining certificate. If provided emails will be digitally signed before sending.

$signingExtraCertsPath public property

Path for extra sigining certificates (i.e. intermidiate certificates).

$signingOptions public property

Bitwise operator options for openssl_pkcs7_sign()

public integer $signingOptions PKCS7_DETACHED
$signingPrivateKeyPath public property

Path for the sigining certificate private key. If provided emails will be digitally signed before sending.

$surpressedRecipients public property (available since version 1.3)

Of surpressed recipient e-mail addresses

public array $surpressedRecipients = ['david.roberts@example.com''sara.schuster@example.com']

Method Details

compose() public method

Creates a new message instance and optionally composes its body content via view rendering.

public \yii\mail\MessageInterface compose ( $view null, array $params = [] )
$view string|array|null

The view to be used for rendering the message body. This can be:

  • a string, which represents the view name or path alias for rendering the HTML body of the email. In this case, the text body will be generated by applying strip_tags() to the HTML body.
  • an array with 'html' and/or 'text' elements. The 'html' element refers to the view name or path alias for rendering the HTML body, while 'text' element is for rendering the text body. For example, ['html' => 'contact-html', 'text' => 'contact-text'].
  • null, meaning the message instance will be returned without body content.

The view to be rendered can be specified in one of the following formats:

  • path alias (e.g. "@app/mail/contact");
  • a relative view name (e.g. "contact") located under \humhub\components\mail\viewPath.
$params array

The parameters (name-value pairs) that will be extracted and made available in the view file.

return \yii\mail\MessageInterface

Message instance.

isRecipientSurpressed() public method (available since version 1.3)

Checks if an given e-mail address is surpressed.

public boolean isRecipientSurpressed ( $email )
$email
return boolean

Is surpressed

sendMessage() public method

public void sendMessage ( $message )
$message humhub\components\mail\Message