PHP Class Bogardo\Mailgun\Mail\Message

Show file Open project: bogardo/mailgun Class Usage Examples

Protected Properties

Property Type Description
$messageBuilder Mailgun\Messages\MessageBuilder
$variables array

Public Methods

Method Description
__construct ( MessageBuilder $messageBuilder, Illuminate\Contracts\Config\Repository $config ) Message constructor.
attach ( string $path, string $name = '' ) : Message Attach a file to the message.
bcc ( string | array $address, string $name = "", array $variables = [] ) : Message Add a blind carbon copy to the message.
builder ( ) : MessageBuilder
campaign ( integer | string | array $campaigns ) : Message Add Mailgun campaign ID(s) to the message Campaign ID limit is 3.
cc ( string | array $address, string $name = "", array $variables = [] ) : Message Add a carbon copy to the message.
data ( string $key, mixed $data ) : Message Attach custom data to a message.
dkim ( boolean $enabled ) : Message Enable/disable DKIM signature on per-message basis.
embed ( string $path, string $name = null ) : string Embed a file in the message and get the CID.
from ( string $address, string $name = "" ) Set from address
getFiles ( ) : array Get the files from MessageBuilder
getMessage ( ) : array Get the message from MessageBuilder and apply custom/extra data
header ( string $key, string $value ) : Message Append a custom MIME header to a message.
recipientVariables ( array $variables ) Set/Overwrite recipientVariables
replyTo ( string $address, string $name = "" ) : Message Add a reply-to address to the message.
subject ( string $subject ) : Message Set the subject of the message.
tag ( string | array $tags ) : Message Add Mailgun tags to the message.
testmode ( boolean | string $enabled = true ) : Message Enable or disable test-mode on a per-message basis.
to ( string | array $address, string $name = "", array $variables = [] ) : Message Add a recipient to the message.
trackClicks ( boolean | string $value ) : Message Toggles clicks tracking on a per-message basis.
trackOpens ( boolean $enabled ) : Message Toggles opens-tracking on a per-message basis.

Protected Methods

Method Description
setConfigFrom ( ) Set from address from config
setConfigNativeSend ( ) Force the from address (see description in config).
setConfigReplyTo ( ) Apply reply-to address from config.
setConfigTestMode ( ) Enable/Disable test-mode depending on config setting.

Method Details

__construct() public method

Message constructor.
public __construct ( MessageBuilder $messageBuilder, Illuminate\Contracts\Config\Repository $config )
$messageBuilder Mailgun\Messages\MessageBuilder
$config Illuminate\Contracts\Config\Repository

attach() public method

Attach a file to the message.
public attach ( string $path, string $name = '' ) : Message
$path string
$name string
return Message

bcc() public method

Add a blind carbon copy to the message.
public bcc ( string | array $address, string $name = "", array $variables = [] ) : Message
$address string | array
$name string
$variables array
return Message

builder() public method

public builder ( ) : MessageBuilder
return Mailgun\Messages\MessageBuilder

campaign() public method

Add Mailgun campaign ID(s) to the message Campaign ID limit is 3.
public campaign ( integer | string | array $campaigns ) : Message
$campaigns integer | string | array
return Message

cc() public method

Add a carbon copy to the message.
public cc ( string | array $address, string $name = "", array $variables = [] ) : Message
$address string | array
$name string
$variables array
return Message

data() public method

Attach custom data to a message.
public data ( string $key, mixed $data ) : Message
$key string
$data mixed
return Message

dkim() public method

Enable/disable DKIM signature on per-message basis.
public dkim ( boolean $enabled ) : Message
$enabled boolean
return Message

embed() public method

Embed a file in the message and get the CID.
public embed ( string $path, string $name = null ) : string
$path string
$name string
return string

from() public method

Set from address
public from ( string $address, string $name = "" )
$address string
$name string

getFiles() public method

Get the files from MessageBuilder
public getFiles ( ) : array
return array

getMessage() public method

Get the message from MessageBuilder and apply custom/extra data
public getMessage ( ) : array
return array

header() public method

Append a custom MIME header to a message.
public header ( string $key, string $value ) : Message
$key string
$value string
return Message

recipientVariables() public method

Set/Overwrite recipientVariables
public recipientVariables ( array $variables )
$variables array

replyTo() public method

Add a reply-to address to the message.
public replyTo ( string $address, string $name = "" ) : Message
$address string
$name string
return Message

setConfigFrom() protected method

Set from address from config
protected setConfigFrom ( )

setConfigNativeSend() protected method

Force the from address (see description in config).
protected setConfigNativeSend ( )

setConfigReplyTo() protected method

Apply reply-to address from config.
protected setConfigReplyTo ( )

setConfigTestMode() protected method

Enable/Disable test-mode depending on config setting.
protected setConfigTestMode ( )

subject() public method

Set the subject of the message.
public subject ( string $subject ) : Message
$subject string
return Message

tag() public method

Tag limit is 3.
public tag ( string | array $tags ) : Message
$tags string | array
return Message

testmode() public method

Enable or disable test-mode on a per-message basis.
public testmode ( boolean | string $enabled = true ) : Message
$enabled boolean | string
return Message

to() public method

Add a recipient to the message.
public to ( string | array $address, string $name = "", array $variables = [] ) : Message
$address string | array
$name string
$variables array
return Message

trackClicks() public method

This setting has a higher priority than the domain-level setting. Pass true, false or 'html' or 'htmlonly'.
public trackClicks ( boolean | string $value ) : Message
$value boolean | string
return Message

trackOpens() public method

This setting has a higher priority than the domain-level setting.
public trackOpens ( boolean $enabled ) : Message
$enabled boolean
return Message

Property Details

$messageBuilder protected property

protected MessageBuilder,Mailgun\Messages $messageBuilder
return Mailgun\Messages\MessageBuilder

$variables protected property

protected array $variables
return array