ResourcesAPI documentation

mailkit.sendmail_mass

Send message using an existing campaign to multiple recipients.

API call example:

XML

<?xml version="1.0"?>
<methodCall>
  <methodName>mailkit.sendmail_mass</methodName>
  <params>
    <param>
      <value>
        <int>client_id</int>
      </value>
    </param>
    <param>
      <value>
        <string>client_md5</string>
      </value>
    </param>
    <param>
        <value>
          <array>
            <data>
              <value>
                <struct>
                  <member>
                    <name>send_to</name>
                    <value>
                      <string>email@email.com</string>
                    </value>
                  </member>
                  <member>
                    <name>mailinglist_id</name>
                    <value>
                      <int>ID of mailing list</int>
                    </value>
                  </member>
                  <member>
                    <name>campaign_id</name>
                    <value>
                      <int>ID of campaign</int>
                    </value>
                  </member>
                  <member>
                    <name>subject</name>
                    <value>
                      <string>subject</string>
                    </value>
                  </member>
                  <member>
                    <name>message_data</name>
                    <value>
                      <string>content</string>
                    </value>
                  </member>
                  <member>
                    <name>template_file</name>
                    <value>
                      <string>template</string>
                    </value>
                  </member>
                  <member>
                    <name>create_email</name>
                    <value>
                      <string>TRUE</string>
                    </value>
                  </member>
                  <member>
                    <name>customs</name>
                    <value>
                        <struct>
                            <member>
                                <name>custom1</name>
                                <value>Custom field no.1</value>
                            </member>
                            <member>
                                <name>custom25</name>
                                <value>Custom field no.25</value>
                            </member>
                            <member>
                                <name>first_name</name>
                                <value>First name</value>
                            </member>
                            <member>
                                <name>last_name</name>
                                <value>Last name</value>
                            </member>            
                        </struct>
                    </value>
                  </member>                  
                  <member>
                    <name>attachment</name>
                    <value>
                      <array>
                        <data>
                          <value>
                            <struct>
                              <member>
                                <name>url</name>
                                <value>
                                  <string>url of attachment</string>
                                </value>
                              </member>
                              <member>
                                <name>name</name>
                                <value>
                                  <string>name of attachment</string>
                                </value>
                              </member>
                              nebo
                              <member>
                                <name>data</name>
                                <value>data of attachment in Base64</value>
                              </member>
                            </struct>
                          </value>
                        </data>
                      </array>
                    </value>
                  </member>
                  <member>
                    <name>content</name>
                    <value>
                      <struct>
                        <member>
                          <name>var1</name>
                          <value>
                            <string>variable</string>
                          </value>
                        </member>
                        <member>
                          <name>other_name</name>
                          <value>
                            <string>other name</string>
                          </value>
                        </member>
                      </struct>
                    </value>
                  </member>
                </struct>
              </value>
            </data>
          </array>
        </value>
    </param>
    <param>
        <value>
            <struct>
                <member>
                  <name>id_send</name>
                  <value>
                    <string>today</string>
                  </value>
                </member>
            </struct>
        </value>
    </param>
  </params>
</methodCall>

JSON

{
    "function": "mailkit.sendmail_mass",
    "id": "client_id",
    "md5": "client_md5",
    "recipients": [
        {
            "send_to": "email@email.eu",
            "mailinglist_id": 123456,
            "campaign_id": 123456,
            "subject":"Message subject",
            "message_data":"base64 encoded message body",
            "create_email":true,
            "customs": {
                "first_name": "First name",
                "last_name": "Last name",
                "custom1": "custom field",
                "custom2": "custom field"
            },
            "content": {
                "var1": "variable content"
            }
        },
        {
            "send_to": "email2@email2.eu",
            "mailinglist_id": 123456,
            "campaign_id": 123456,
            "subject":"Message subject",
            "message_data":"base64 encoded message body",
            "create_email":true,
            "customs": {
                "first_name": "First name",
                "last_name": "Last name",
                "custom1": "custom field",
                "custom2": "custom field"
            },
            "content": {
                "var1": "variable content"
            }
        }
    ]
}

Values

client_id * = client ID can be found in your Mailkit account's menu Profile / Integration / API settings.
client_md5 * = MD5 code can be found in your Mailkit account's menu Profile / Integration / API settings.
send_to * = e-mail address of recipient
mailinglist_id * = ID of mailing list
campaign_id * = ID of campaign
subject = other subject of campaign (optional)
message_data (base64) = other content of message (optional)
template_file = other template of campaign (optional)
create_email = add e-mail address to the mailing list:

  • TRUE = recipient address will be added if not present in the mailing list yet
  • FALSE = recipient address will not be added to the mailing list if not present and therefor no email will be sent

customs = recipient personalisation data (name, custom fields, etc.). Provided data will update the recipient's record in the mailing list (optional)
attachment = attachment of campaign (optional). It is possible to send url of attachment or data of attachment
Attachements can obly be added to transactional messagesIf an attachment value will be passed for non-transactional message the the request will be ignored and message not sent.
- name = name of attachment
- url = url of attachment
- data (base64) = data of attachment

content (base64) = variable content that gets stored in structures named shared (for key/value pairs), resp. data (for complex structures and arrays). Data from these structures can later be used in template using tags [% shared.VARIABLE_NAME -%], resp. [% data.STRUCTURE_NAME -%]. If an array of variables is passed in the content the individual values in the array are to be passed unenencoded.
id_send = using value "today" allows to merge subsequent deliveries into one single reporting delivery.
* required value

Successful call response:

XML

<methodResponse>
  <params>
    <param>
    <value>
      <struct>
        <member>
          <name>data</name>
          <value>
            <string>OK</string>
          </value>
        </member>
        <member>
          <name>list</name>
          <value>
            <array>
              <data>
                <value>
                  <string>email@email.eu</string>
                </value>
                <value>
                  <string>email2@email2.eu</string>
                </value>
              </data>
            </array>
          </value>
        </member>
      </struct>
    </value>
    </param>
  </params>
</methodResponse>
		

JSON

{
    "list": [
        "email@email.eu",
        "email2@email2.eu"
    ],
    "data": "OK",
    "request_id": "123456",
    "error_status": 0
}

Values

data = OK = campaign will be sent
list = list of recipients
request_id = Identifier of the request that can be used to retrieve results and possible errors that occurred during processing of the request.
error_status

  • 0 = succesfull request
  • 1+ = unsuccesfull request