Mail Classes API
- Table of Contents
- Overview
- Non-Configurable Attributes
- Configurable Attributes
- Get a List of Mail Classes
- Get Details on a Single Mail Class
- Create a Mail Class
- Update a Mail Class
- Delete a Mail Class
Overview
GreenArrow Engine’s SimpleMH system classifies mail into Mail Classes. Each message that’s processed by SimpleMH is assigned a Mail Class, which is used to determine which SimpleMH Mail Features to use.
Non-Configurable Attributes
The following Mail Class attributes are not configurable via this API but are configurable with GreenArrow Engine’s web interface.
- Regex Before HTML Conversion
- Regex After HTML Conversion
- Regex for HTML Part
- Regex for Text Part
All other Mail Class attributes are configurable via this API.
Configurable Attributes
The following are the configurable attributes defined for Mail Classes.
mail_class
hash /required
|
Get a List of Mail Classes
GET /ga/api/v3/eng/mail_classes
Parameters
The following parameters are valid for the above endpoint.
page
integer /optional |
The page number from which to retrieve. Page numbering starts at |
page_token
string /optional |
The |
name
string /optional |
Filter the results to just a single Mail Class with this name (case-insensitive). |
Examples:
GET /ga/api/v3/eng/mail_classes?page={page}
GET /ga/api/v3/eng/mail_classes?page_token={page_token}
GET /ga/api/v3/eng/mail_classes?name={name}
Response
The response will contain a list of Mail Classes in the following format.
mail_classes
array of hashes
|
|||||||||||
pagination
hash
|
Example 1: Get the First Page of Mail Classes
GET /ga/api/v3/eng/mail_classes
HTTP/1.1 200 OK
{
"success": true,
"data": {
"mail_classes": [
{
"id": 1,
"name": "my_mail_class_one"
},
{
"id": 2,
"name": "my_mail_classtwo"
},
{
"id": 3,
"name": "my_mail_class_three"
},
{
"id": 4,
"name": "my_mail_class_four"
}
],
"pagination": {
"page": 0,
"per_page": 100,
"num_pages": 1,
"num_records": 4,
"next_page_token": null
}
},
"error_code": null,
"error_messages": null
}
Example 2: Find a Mail Class by Name
GET /ga/api/v3/eng/mail_classes?name=my_mail_classtwo
HTTP/1.1 200 OK
{
"success": true,
"data": {
"mail_classes": [
{
"id": 2,
"name": "my_mail_classtwo"
}
],
"pagination": {
"page": 0,
"per_page": 100,
"num_pages": 1,
"num_records": 1,
"next_page_token": null
}
},
"error_code": null,
"error_messages": null
}
Get Details on a Single Mail Class
GET /ga/api/v3/eng/mail_classes/{id}
Response
The response will contain details on the requested record:
mail_class
hash |
The attributes for this hash are defined in the Attributes section of this document. |
Example
GET /ga/api/v3/eng/mail_classes/1
HTTP/1.1 200 OK
{
"success": true,
"data": {
"mail_class": {
"id": 1,
"name": "my_mail_class_one",
"listid": "mc_listid_109",
"seed": {
"start": 1,
"end": 3
},
"track_clicks_and_opens": false,
"manage_unsubscribe_links": false,
"archive_sample_count": null,
"convert_textonly_to_html": {
"do_conversion": false,
"header": null,
"footer": null,
"link_text": null
},
"modify_html": null,
"bounce_message_passthrough": false,
"bounce_address": {
"address": null,
"use_system_default": true
},
"bcc": null,
"add_email_headers": null,
"virtual_mta": {
"id": 0,
"name": "System Default Route"
},
"url_domain": null,
"add_message_id_if_missing": false,
"disable_auto_list_unsubscribe_header": false,
"handle_bounce_and_fbl": true,
"event_tracking_metadata_storage": null,
"statistic_report_grouping": "per_day"
}
},
"error_code": null,
"error_messages": null
}
Create a Mail Class
POST /ga/api/v3/eng/mail_classes
Payload
mail_class
hash /required |
The content of this hash is described in the Attributes section of this page. The data may contain a mixture of required and optional fields. Do not specify read-only fields. |
Response
The response will include a mail_class
key containing the full Mail Class
record as defined in the Mail Class Attributes.
Example
POST /ga/api/v3/eng/mail_classes
{
"mail_class": {
"name": "a_new_mail_class",
"listid": "12345",
"virtual_mta": {
"id": 0
},
"manage_unsubscribe_links": true,
"add_message_id_if_missing": true,
"bounce_message_passthrough": true,
"disable_auto_list_unsubscribe_header": true,
"handle_bounce_and_fbl": true,
"event_tracking_metadata_storage": "stateless"
}
}
HTTP/1.1 200 OK
{
"success": true,
"data": {
"mail_class": {
"id": 5,
"name": "a_new_mail_class",
"listid": "12345",
"seed": null,
"track_clicks_and_opens": false,
"manage_unsubscribe_links": true,
"archive_sample_count": null,
"convert_textonly_to_html": {
"do_conversion": false,
"header": null,
"footer": null,
"link_text": null
},
"modify_html": null,
"bounce_message_passthrough": true,
"bounce_address": {
"address": null,
"use_system_default": true
},
"bcc": null,
"add_email_headers": null,
"virtual_mta": {
"id": 0,
"name": "System Default Route"
},
"url_domain": null,
"add_message_id_if_missing": true,
"disable_auto_list_unsubscribe_header": true,
"handle_bounce_and_fbl": true,
"event_tracking_metadata_storage": "stateless",
"statistic_report_grouping": "per_day"
}
},
"error_code": null,
"error_messages": null
}
Update a Mail Class
PUT /ga/api/v3/eng/mail_classes/{id}
Payload
mail_class
hash /required |
The content of this hash is described in the Attributes section of this page. The data may contain a mixture of required and optional fields. Do not specify read-only fields. |
Response
The response will include a mail_class
key containing the full Mail Class
record as defined in the Mail Class Attributes.
Example
PUT /ga/api/v3/eng/mail_classes/2
{
"mail_class": {
"name": "updated_name_three",
"seed": {
"start": 10,
"end": 20
},
"bcc": "[email protected]",
"convert_textonly_to_html": {
"do_conversion": true,
"header": "html header",
"footer": "html footer",
"link_text": "html link text"
},
"modify_html": {
"html_header": "modified html header",
"html_footer": "modified html footer",
"text_header": "text header",
"text_footer": "text footer"
},
"add_email_headers": "X-Test: Header",
"add_message_id_if_missing": true,
"disable_auto_list_unsubscribe_header": true,
"handle_bounce_and_fbl": false
}
}
HTTP/1.1 200 OK
{
"success": true,
"data": {
"mail_class": {
"id": 2,
"name": "updated_name_three",
"listid": "mc_listid_842",
"seed": {
"start": 10,
"end": 20
},
"track_clicks_and_opens": false,
"manage_unsubscribe_links": false,
"archive_sample_count": null,
"convert_textonly_to_html": {
"do_conversion": true,
"header": "html header",
"footer": "html footer",
"link_text": "html link text"
},
"modify_html": {
"html_header": "modified html header",
"html_footer": "modified html footer",
"text_header": "text header",
"text_footer": "text footer"
},
"bounce_message_passthrough": false,
"bounce_address": {
"address": null,
"use_system_default": true
},
"bcc": "[email protected]",
"add_email_headers": "X-Test: Header\n",
"virtual_mta": {
"id": 0,
"name": "System Default Route"
},
"url_domain": null,
"add_message_id_if_missing": true,
"disable_auto_list_unsubscribe_header": true,
"handle_bounce_and_fbl": false,
"event_tracking_metadata_storage": null,
"statistic_report_grouping": "per_day"
}
},
"error_code": null,
"error_messages": null
}
Delete a Mail Class
DELETE /ga/api/v3/eng/mail_classes/{id}
Response
The response is a standard success or error response.
Example
DELETE /ga/api/v3/eng/mail_classes/2
HTTP/1.1 200 OK
{
"success": true,
"data": {
},
"error_code": null,
"error_messages": null
}