Back to MailTemplate class

Method addAttachment

public void
addAttachment
(mixed $name, mixed $file)
Add an attachment to the mail
Parameters
  • string $name Filename of the attachment
  • string $file Either a filepath or filecontent
Returns
  • void
Since
  • 4.0.0
Class: MailTemplate
Project: Joomla

Method addAttachment - Source code

/**
 * Add an attachment to the mail
 *
 * @param   string  $name  Filename of the attachment
 * @param   string  $file  Either a filepath or filecontent
 *
 * @return  void
 *
 * @since   4.0.0
 */
public function addAttachment($name, $file)
{
    $attachment = new \stdClass();
    $attachment->name = $name;
    $attachment->file = $file;
    $this->attachments[] = $attachment;
}