Inherits from NSObject
Declared in MGMessage.h

Tasks

Managing Message Setup

  •   from

    Email address for From header

    property
  •   to

    Email address of the recipient(s). Example: “Bob bob@host.com”.

    property
  •   cc

    Email address of the CC recipient(s). Example: “Bob bob@host.com”.

    property
  •   bcc

    Email address of the BCC recipient(s). Example: “Bob bob@host.com”.

    property
  •   subject

    Message subject

    property
  •   text

    Body of the message, text version

    property
  •   html

    Body of the message. HTML version

    property

Mailgun Message Configuration

Creating and Initializing a Mailgun Message

Adding Message Metadata

Adding Additional Recipients

Adding Attachments

Properties

attachments

NSMutableDictionary of attachments to the message.

@property (nonatomic, strong, readonly) NSMutableDictionary *attachments

Declared In

MGMessage.h

bcc

Email address of the BCC recipient(s). Example: “Bob bob@host.com”.

@property (nonatomic, strong) NSArray *bcc

Declared In

MGMessage.h

campaign

ID of the campaign the message belongs to. See Campaign Analytics for details.

@property (nonatomic, strong) NSString *campaign

Declared In

MGMessage.h

cc

Email address of the CC recipient(s). Example: “Bob bob@host.com”.

@property (nonatomic, strong) NSArray *cc

Declared In

MGMessage.h

deliverAt

An NSDate representing the desired time of delivery.

@property (nonatomic, strong) NSDate *deliverAt

Declared In

MGMessage.h

dkim

Enables/disables DKIM signatures on per-message basis.

@property (nonatomic) BOOL *dkim

Declared In

MGMessage.h

from

Email address for From header

@property (nonatomic, strong) NSString *from

Declared In

MGMessage.h

headers

NSMutableDictionary of custom MIME headers to the message. For example, Reply-To to specify a Reply-To address.

@property (nonatomic, strong, readonly) NSMutableDictionary *headers

Declared In

MGMessage.h

html

Body of the message. HTML version

@property (nonatomic, strong) NSString *html

Declared In

MGMessage.h

inlineAttachments

NSMutableDictionary of inline message attachments.

@property (nonatomic, strong, readonly) NSMutableDictionary *inlineAttachments

Declared In

MGMessage.h

subject

Message subject

@property (nonatomic, strong) NSString *subject

Declared In

MGMessage.h

tags

An NSArray of tag strings. See Tagging for more information.

@property (nonatomic, strong, readonly) NSArray *tags

Declared In

MGMessage.h

testing

Enables sending in test mode. See Sending in Test Mode

@property (nonatomic) BOOL *testing

Declared In

MGMessage.h

text

Body of the message, text version

@property (nonatomic, strong) NSString *text

Declared In

MGMessage.h

to

Email address of the recipient(s). Example: “Bob bob@host.com”.

@property (nonatomic, strong) NSArray *to

Declared In

MGMessage.h

trackClicks

Toggles clicks tracking on a per-message basis. Has higher priority than domain-level setting.

@property (nonatomic) ClickTrackingType trackClicks

Declared In

MGMessage.h

trackOpens

Toggles opens tracking on a per-message basis. Has higher priority than domain-level setting.

@property (nonatomic) BOOL *trackOpens

Declared In

MGMessage.h

tracking

Toggles tracking on a per-message basis, see Tracking Messages for details.

@property (nonatomic) BOOL *tracking

Declared In

MGMessage.h

variables

NSMutableDictionary for attaching custom JSON data to the message. See Attaching Data to Messages for more information.

@property (nonatomic, strong, readonly) NSMutableDictionary *variables

Declared In

MGMessage.h

Class Methods

messageFrom:to:subject:body:

Creates and initializes a message with the provided details.

+ (instancetype)messageFrom:(NSString *)from to:(NSString *)to subject:(NSString *)subject body:(NSString *)body

Parameters

from

The message sender. Must not be nil.

to

The message recipient. Must not be nil.

subject

The message subject. Must not be nil.

body

The body of the message.

Declared In

MGMessage.h

Instance Methods

addAttachment:withName:type:

Adds an attachment to the receiver.

- (void)addAttachment:(NSData *)data withName:(NSString *)name type:(NSString *)type

Parameters

data

The NSData to be attached to the message. Must not be nil.

name

The name used to identify this attachment in the message. Must not be nil.

type

The MIME type used to describe the contents of data. Must not be nil.

Declared In

MGMessage.h

addBcc:

Adds a BCC recipient to the receiver.

- (void)addBcc:(NSString *)recipient

Parameters

recipient

The recipient to add to the BCC field of the message. Must not be nil.

Declared In

MGMessage.h

addCc:

Adds a CC recipient to the receiver.

- (void)addCc:(NSString *)recipient

Parameters

recipient

The recipient to add to the CC field of the message. Must not be nil.

Declared In

MGMessage.h

addHeader:value:

Adds a header and value to the receiver’s metadata.

- (void)addHeader:(NSString *)header value:(NSString *)value

Parameters

header

The header identifier to add. Must not be nil.

value

The value for the identifier. Must not be nil.

Declared In

MGMessage.h

addImage:withName:type:

Adds a UIImage as an attachment to the receiver.

- (void)addImage:(UIImage *)image withName:(NSString *)name type:(ImageAttachmentType)type

Parameters

image

The UIImage to be attached to the message. Must not be nil.

name

The name used to identify this image attachment in the message. Must not be nil.

type

The ImageAttachmentType to identify this image as a JPEG or a PNG.

Declared In

MGMessage.h

addImage:withName:type:inline:

Adds a UIImage as an attachment to the receiver but inline in the message body.

- (void)addImage:(UIImage *)image withName:(NSString *)name type:(ImageAttachmentType)type inline:(BOOL)inlineAttachment

Parameters

image

The UIImage to be attached to the message. Must not be nil.

name

The name used to identify this attachment in the message. Must not be nil.

type

The ImageAttachmentType to identify this image as a JPEG or a PNG.

Declared In

MGMessage.h

addRecipient:

Adds an additional recipient to the receiver.

- (void)addRecipient:(NSString *)recipient

Parameters

recipient

The recipient to add to the message. Must not be nil.

Declared In

MGMessage.h

addTag:

Adds a single tag to this recevier’s metadata.

- (void)addTag:(NSString *)tag

Parameters

tag

The tag to add to this recevier’s metadata. Must not be nil.

Declared In

MGMessage.h

addTags:

Adds multiple tags to the recevier’s metadata.

- (void)addTags:(NSArray *)tags

Parameters

tags

An NSArray containing the tags to add to this recevier’s metadata. Must not be nil.

Declared In

MGMessage.h

addVariable:value:

Adds a variable and a value to the receiver.

- (void)addVariable:(NSString *)var value:(NSString *)value

Parameters

var

The variable name. Must not be nil.

value

The value of the variable to display in the message.

Declared In

MGMessage.h

dictionary

- (NSDictionary *)dictionary

initWithFrom:to:subject:body:

The designated initializer to create a message with the provided details.

- (id)initWithFrom:(NSString *)from to:(NSString *)to subject:(NSString *)subject body:(NSString *)body

Parameters

from

The message sender. Must not be nil.

to

The message recipient. Must not be nil.

subject

The message subject. Must not be nil.

body

The body of the message.

Declared In

MGMessage.h