Back to MailTemplate class

Method addRecipient

public void
addRecipient
(mixed $mail, mixed $name = null, mixed $type = 'to')
Adds recipients for this mail
Parameters
  • string $mail Mail address of the recipient
  • string $name Name of the recipient
  • string $type How should the recipient receive the mail? ('to', 'cc', 'bcc')
Returns
  • void
Since
  • 4.0.0
Class: MailTemplate
Project: Joomla

Method addRecipient - Source code

/**
 * Adds recipients for this mail
 *
 * @param   string  $mail  Mail address of the recipient
 * @param   string  $name  Name of the recipient
 * @param   string  $type  How should the recipient receive the mail? ('to', 'cc', 'bcc')
 *
 * @return  void
 *
 * @since   4.0.0
 */
public function addRecipient($mail, $name = null, $type = 'to')
{
    $recipient = new \stdClass();
    $recipient->mail = $mail;
    $recipient->name = $name ?? $mail;
    $recipient->type = $type;
    $this->recipients[] = $recipient;
}