TransactionalJobSubmit v3.1

TransactionalJobSubmit is used to send a single email to a single email address. This is the easiest way to send transactional email as it does not require the creation of a separate recipient file accessible to the MessageGears system. All data needed to fulfill the request is supplied in the API call.

Prior Versions

Required Parameters

Parameter Personalizable Description
Action TransactionalJobSubmit
AccountId The MessageGears account id to which this item belongs.
ApiKey A secret key only known by you. Keep this key confidential.
FromAddress
Yes
The "from email address" value. This field can be personalized using one of the supported template languages.
SubjectLine
Yes
The value used as the subject line. You can personalize this field using one of the supported template languages.
RecipientXml The XML for a single recipient supplied in the prescribed format.

Click here for more information.
HtmlTemplate
Yes
The HTML template used for the HTML part of the email messages. At least one template must be provided (Text or HTML). If both are provided then a “multipart” message is sent and each email recipient’s email reader determines which content type to display.
TextTemplate
Yes
The text template used for the text part of the email message.

Optional Parameters

Parameter Personalizable Description
FromName
Yes
The "from name" value. This header is supported by most email clients and displays in place of (or sometime along with) the “from email address” in the recipients email reader.
OnBehalfOfName
Yes
Sets the "On Behalf Of" name part of the "Sender" header.

Click here for more information regarding the use of OnBehalfOf.
OnBehalfOfAddress
Yes
Sets the "On Behalf Of" email address part of the "Sender" header.
ReplyToAddress
Yes
This email address is used when the client selects "reply to" in their email reader. If not specified, the from address is used.
TemplateLanguage Valid values are: FREEMARKER or VELOCITY. If no value is specified, FREEMARKER is used by default.

Click here for more information regarding dynamic email content.
NotificationEmailAddress If this value is specified, any errors that are encountered in processing the job are emailed to this address. This can be very helpful for initial development and testing.
AttachmentUrl.n The URL where the attachment file is located. As many as 5 attachments can be supplied. Each attachment must have the appropriate suffix (i.e. .1, .2, .3, .4, .5).

Click here for more information regarding attachments.
AttachmentContent.n The base64 encoded string containing the attachment content. As many as 5 attachments can be supplied. Each attachment must have the appropriate suffix (i.e. .1, .2, .3, .4, .5).

Click here for more information regarding attachments.
AttachmentName.n The name displayed in the email message for the attached file. This is an optional field and if not provided, the name of the file is used as the attachment name.
AttachmentContentType.n The content type associated with the attachment.
CharacterSet The character set in which the email message will be encoded. If this field is not set, the default value of UTF-8 is used.

Click here for a full list of available character sets.
AutoTrack If set to "true" (case insensitive) all links in the HTML content will be made trackable. Otherwise, they will not. If true, any link inside an anchor tag, or image map tag will be marked as trackable. If the tag specifies a "name" attribute, the name will be set as the link name in your activity data.

Click here for more information.
UrlAppend
Yes
Use this optional field to specify a string to be appended to each trackable link in your HTML content. This parameter will only be accepted if the AutoTrack option above is set to "true". It can be helpful when used in conjunction with a web analytics system such as Google Analytics to add your campaign Id and other data to each of your links.

Click here for more information.
CustomTrackingDomain This optional field is used to provide a custom domain name to be used for trackable links and the open tracking URL. You must set a CNAME in your DNS that points to www.messagegears.net. Please test this carefully before using. Example: http://www.mycompany.com (please include the protocol/prefix).

Click here for more information.
HeaderName.n The name of a custom header to be included with the message. You may have up to 5 custom headers each with the appropriate suffix (i.e. .1, .2, .3, .4, .5).

Click here for more information regarding customer headers.
HeaderValue.n The value of the header.
CorrelationId This field allows you to supply your own job id. This Id will be returned with all reporting data (including the real-time data feed) and can make it much easier to match events coming out of MessageGears with the job they belong to in your own system.
UnsubscribeHeader If set to "true" (case insensitive) a header named "List-Unsubscribe" will be added to your message. Otherwise, it will not. This header is used by several ISPs (most notably GMail) and allows users to click an unsubscribe button in their email reader. You will receive an "unsubscribe" event in your activity data for each click of the unsubscribe button. This is the same event that would result from an unsubscribe link included in your HTML template using the ${Gears.unsubscribe()} Freemarker command.

Click here for more information.

Programming Examples

Request

https://api.messagegears.net/3.1/WebService
?Action=TransactionalJobSubmit
&AccountId=123456789
&ApiKey=8bb6118f8fd6935ad0876a3be34a717d32708ffd
&FromName=MessageGears
&FromAddress=info@messagegears.com
&SubjectLine=Welcome!
&HtmlTemplate=Hello, World!
&RecipientXml=me@mydomain.com

Response

    t23110-a9e77b7c-c980-4ff5-8ede-546fbe0bad66
    REQUEST_SUCCESSFUL

Click here to see more details about using the MessageGears Java SDK
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
package com.messagegears.sdk.examples;
 
import com.messagegears.sdk.v3_1.TransactionalJobSubmitResponse;
import com.messagegears.sdk.MessageGearsClient;
import com.messagegears.sdk.MessageGearsProperties;
import com.messagegears.sdk.model.request.TransactionalJobSubmitRequest;
import com.messagegears.sdk.output.ScreenWriter;
 
public class TransactionalJobSubmit {
 
    public static void main(String[] args) {
        // Create the properties object containing the necessary properties
        MessageGearsProperties properties = new MessageGearsProperties();
        properties.setMyMessageGearsAccountId("place your MessageGears account id here");
        properties.setMyMessageGearsApiKey("place your MessageGears api key here");
 
        // Create the main client object
        MessageGearsClient client = new MessageGearsClient(properties);
 
        // Create a transactional job request
        TransactionalJobSubmitRequest request = new TransactionalJobSubmitRequest();
 
        // Create the XML that represents the email recipient
        // (the Recipient and EmailAddress elements are required)
        request.setRecipientXml("<Recipient><EmailAddress>" +
            "place your email address here" + "</EmailAddress><FirstName>You</FirstName></Recipient>");
 
        // Set the message content
        request.setFromName("MessageGears");
        request.setFromAddress("no-reply@messagegears.com");
        request.setSubjectLine("MessageGears - Reliable Message Delivery");
 
        // Set the HTML part of the message (using some simple personalization)
        request.setHtmlTemplate("Hello, ${Recipient.FirstName}!");
 
        // Execute the request
        TransactionalJobSubmitResponse response = client.transactionalJobSubmit(request);
 
        // Print the result (success or failure)
        ScreenWriter.printResponse(response);
    }
 
}
package com.messagegears.sdk.examples;

import com.messagegears.sdk.v3_1.TransactionalJobSubmitResponse;
import com.messagegears.sdk.MessageGearsClient;
import com.messagegears.sdk.MessageGearsProperties;
import com.messagegears.sdk.model.request.TransactionalJobSubmitRequest;
import com.messagegears.sdk.output.ScreenWriter;

public class TransactionalJobSubmit {

    public static void main(String[] args) {
        // Create the properties object containing the necessary properties
        MessageGearsProperties properties = new MessageGearsProperties();
        properties.setMyMessageGearsAccountId("place your MessageGears account id here");
        properties.setMyMessageGearsApiKey("place your MessageGears api key here");

        // Create the main client object
        MessageGearsClient client = new MessageGearsClient(properties);

        // Create a transactional job request
        TransactionalJobSubmitRequest request = new TransactionalJobSubmitRequest();

        // Create the XML that represents the email recipient
        // (the Recipient and EmailAddress elements are required)
        request.setRecipientXml("<Recipient><EmailAddress>" +
            "place your email address here" + "</EmailAddress><FirstName>You</FirstName></Recipient>");

        // Set the message content
        request.setFromName("MessageGears");
        request.setFromAddress("no-reply@messagegears.com");
        request.setSubjectLine("MessageGears - Reliable Message Delivery");

        // Set the HTML part of the message (using some simple personalization)
        request.setHtmlTemplate("Hello, ${Recipient.FirstName}!");

        // Execute the request
        TransactionalJobSubmitResponse response = client.transactionalJobSubmit(request);

        // Print the result (success or failure)
        ScreenWriter.printResponse(response);
    }

}