WireMailMailgun by macrura

Mailgun for ProcessWire


Mailgun module for ProcessWire


Set settings in module configuration page.


Usage is similar to the basic WireMail implementation, although a few extra options are available.

Basic usage is as such:

  1. Initialize $mail = wireMail(); Note this also works: $m = $mail->new();
  2. Set options $mail->to('Someone <someone@example.com>); ...
  3. Send $mail->send();


$WireMailMailgun->to( string|array|null $recipients )

$WireMailMailgun->cc( string|array|null $recipients )

$WireMailMailgun->bcc( string|array|null $recipients )

$WireMailMailgun->setApiKey( string $apiKey )

$WireMailMailgun->setDomainName( string $domainName )

$WireMailMailgun->setTestMode( bool $bool )

$WireMailMailgun->setBatchMode( bool $bool )

When batch mode is set to true (default mode of operation), each recipient passed to the to() method will not be able to see who else is receiving the sent email. This will send one email per "To:" recipient.

Set to false to disable this behavior. This will send one email with multiple "To:" recipients.

Note that in both cases all CCs and BCCs will be delivered for each email sent. This means that if batch mode is on, that you have 10 "To:" recipients and 3 CCs, 40 emails will be sent in total.

Important: Mailgun has a maximum hard limit of recipients allowed per batch of 1,000. Read more about batch sending.

$WireMailMailgun->setToRecipientsVariables( array $array )

Add custom variables for batch mode. ex.:

	'someone@example.com' => array(
		'username' => 'Someone',
		'token' => '123456',
	), ...

$WireMailMailgun->setClickTracking( bool $bool )

$WireMailMailgun->setOpenTracking( bool $bool )

$WireMailMailgun->addAttachment( string $filepath )

Usage is the same as realpath() internally for convenience.

$WireMailMailgun->addTag( string $tag )

Add a tag to the email. Note that there is a maximum number of 3 tags allowed per email.

Also, the tag string should be ASCII only and its length should be 128 characters or less. If any of those conditions are not met, the module will convert any non-ASCII characters to ASCII and trim the string length to 128.

$WireMailMailgun->validateEmail( string $email )

Validates a single address using Mailgun's address validation service.

For more information on what this method returns, see Mailgun's documentation.

Install and use modules at your own risk. Always have a site and database backup before installing new modules.

Twitter updates

  • ProcessWire 3.0.210 new main/master version released— More
    6 January 2023
  • ProcessWire 3.0.209: Core updates and an interesting AI that knows ProcessWire– More
    30 December 2022
  • Implementing and using TinyMCE 6 in ProcessWire– More
    16 December 2022

Latest news

  • ProcessWire Weekly #454
    In the 454th issue of ProcessWire Weekly we'll introduce a couple of brand new third party modules, check out what's new in the latest dev version of ProcessWire (3.0.211), and more. Read on!
    Weekly.pw / 21 January 2023
  • ProcessWire 3.0.210 new main/master version
    140 commits, 55 resolved issues, dozens of new features, eight contributors, and five new pull requests make yet another great new version of ProcessWire.
    Blog / 6 January 2023
  • Subscribe to weekly ProcessWire news

“The end client and designer love the ease at which they can update the website. Training beyond how to log in wasn’t even necessary since ProcessWire’s default interface is straightforward.” —Jonathan Lahijani