Add a file to be attached to the email

  • Multiple calls will append attachments.
  • To remove the supplied attachments, specify NULL as the value.
  • Attachments may or may not be supported by 3rd party WireMail modules.


$m = wireMail();
$m->subject('Test attachment');
$m->body('This is just a test of a file attachment');


// basic usage
$m->attachment(string $value);

// usage with all arguments
$m->attachment(string $value, string $filename = '');



Full path and filename of file attachment

$filename (optional)string

Optional different basename for file as it appears in the mail

Return value


Object instance it was called from (method supports fluent interface).

$m methods and properties

API reference based on ProcessWire core version 3.0.109