WireMail::attachment() method

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.

Example

$m = wireMail();
$m->to('user@domain.com')->from('hello@world.com');
$m->subject('Test attachment');
$m->body('This is just a test of a file attachment');
$m->attachment('/path/to/file.jpg');
$m->send();

Usage

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

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

Arguments

NameType(s)Description
valuestring

Full path and filename of file attachment

filename (optional)string

Optional different basename for file as it appears in the mail

Return value

$this

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


$m methods and properties

API reference based on ProcessWire core version 3.0.155

Twitter updates

  • This post covers a few of the bigger updates in ProcessWire 3.0.154+3.0.155. This includes new live replacement of text in core and modules, a new method for creating canonical URLs, and some major upgrades to our input->urlSegment() method! More
    24 April 2020
  • A brief look at what's new in ProcessWire 3.0.154 in this forum post: More
    17 April 2020
  • This week we’ve got a few new and interesting core updates in progress, though none quite ready to release just yet. So rather than releasing version 3.0.154 today, I thought we'd instead take a brief look at what’s coming over the next few weeks… More
    3 April 2020

Latest news

  • ProcessWire Weekly #311
    In the 311th issue of ProcessWire Weekly we're going to talk a bit about the latest dev versions of ProcessWire, introduce a couple of new third party modules, and more. Read on!
    Weekly.pw / 25 April 2020
  • ProcessWire 3.0.154 and 3.0.155 core updates
    This post covers a few of the bigger updates in ProcessWire 3.0.154 and 3.0.155 on the dev branch. This includes a new function for live replacement of text in core and modules, a new method for creating canonical URLs, and some major upgrades to our $input->urlSegment() method that I think you’ll like!
    Blog / 24 April 2020
  • Subscribe to weekly ProcessWire news

I just love the easy and intuitive ProcessWire API. ProcessWire rocks!” —Jens Martsch, Web developer