# Emberpoint Mailpublisher Export Integration [Learn more about EmberPoint MailPublisher Import Integration](/int/emberpoint-mailpublisher-import-integration). This integration allows Treasure Data to publish segments into the EmberPoint MailPublisher, enabling the user to send personalized emails. You can run data-driven email campaigns using your first-party data from the Web, Mobile, or CRM. This connector can also be used to import MailPublisher data into Treasure Data. ## Restrictions on MailPublisher Smart Email Delivery List Data MailPublisher Smart has some restrictions for the column name in delivery list data: - The first column name must be "email" - Column name must not contain reserved words - image_[number] e.g. image_001 - linkurl_[number] e.g. linkurl_001 - cvurl_[number] e.g. cvurl_001 - boundary[number] e.g. boundary00 - carrier_type - code_mini - Column name must not contain the characters given below - "-" (hyphen) and " " (space) - Column value can't contain a "," (comma), '"' (double quote) and a new line (CR/LF/CRLF) for now. - Column value must not contain special characters such as IBM extended (ja: IBM拡張), NEC extended kanji (ja: NEC拡張漢字), or number enclosed within a circle (ja: 丸数字) like ①. - The email string in column value must have a valid format. Invalid formatted email addresses will be removed when you upload the email delivery list. The uploaded file will be encoded with the Shift_JIS character encoding when you choose "Japan" as the destination. Some of the text might get jumbled. Refer to the "MailPublisher Smart manual to cooperate with the external system (ja: 外部システムとの連携利用マニュアル)" and the "MailPublisher Smart function manual (ja: 機能説明マニュアル)". You can download both from the MailPublisher Smart console. ## Prerequisites - Basic knowledge of Treasure Data, including the [Toolbelt](https://toolbelt.treasuredata.com/). - A MailPublisher Smart Account with enabled API access (done via MailPublisher Smart Console). ## Limitations - This connector doesn't support a custom endpoint. It only supports the default endpoint. ## MailPublisher Smart Account Information Access to your API-enabled account is required before you can upload the email delivery list. The Site ID can be retrieved from the MailPublisher Smart console. Steps to enable and create a new account for API access: 1. Select **Account** > **Create** (ja: アカウント > 新規作成) in the left menu 2. Create an external system cooperation type User (ja: 利用種別:外部システム連携). ![](/assets/image-20191021-161236.1e135a85e586672b5dc0c8f6b67528d23dc00789c9968695a863bf9ece2c91d9.c00703fc.png) ### Getting a Draft ID To use "send_email" option, you need to get a draft ID which can be found as shown below (メール配信・一覧 > 下書きメール). ![](/assets/image-20191021-161221.991c645aeb7126d791f31f4c2b9dc8f0bc7dbc307823e4940d10bd55c75ca044.c00703fc.png) ### Getting a List ID ![](/assets/image2022-11-23_21-6-47.18b42232d7fa657e4e17d3a86209f85086646bb33b5dd53997a8d0d184e18843.c00703fc.png) ## Use the TD Console to Create Your Connection ### Create a New Connection When you configure a data connection, you provide authentication to access the integration. In Treasure Data, you configure the authentication and then specify the source information. 1. 1. Open the **TD Console**. 2. Navigate to the **Integrations Hub > Catalog**. 3. Click the search icon on the far-right of the Catalog screen, and enter **Mailpublisher**. 4. Hover over the MailPublisher connector and select **Create Authentication**. ![](/assets/emberpointmailpublisher.e2e930d955b4e27c77cff4cff36def99290719661d5534252fd82eb71b2376e0.c00703fc.png) 5. The following dialog opens. ![](/assets/image-20201009-215244.3c7c88619181cba170460d13d723e98deae640f8acff769392974332177b178f.c00703fc.png) 6. Complete the new connection information, providing your MailPublisher Smart credential. - **MailPublisher Smart Site ID** (required): This is your MailPublisher Smart Site ID. - **MailPublisher Smart Login ID** (required): This is service specific Login ID. - **MailPublisher Smart password** (required): This is password for above Login ID. - **Retry limit** (optional, default `7`): Number of retries before the connector stops trying to connect and send data out - **Maximum intervals in milliseconds between retries** (optional, default to `120000`) : Maximum time in milliseconds between retrying attempts. - **Initial intervals in milliseconds between retries** (optional, default `15000`): Interval to retry if a recoverable error happens (in millisecond). - MailPublisher Smart announces minimal retry interval time should be 15 sec (15000 ms). - **Timeout** (optional, default to `100000`) : Timeout for each HTTP request in milliseconds. ### Name Your Connection 1. Type a name for your connection. 2. Select **Done.** ### Define your Query - The column name is case-insensitive. For example, you can use `email` or `EMAIL`. - Example Query 1. Navigate to **Data Workbench > Queries**. 2. Select New Query or search for the query you want to use. 3. Review the following sample queries: ```SQL SELECT email, td_global_id as tdglobalid, firstname, lastname, company FROM ( VALUES ('name+test1@treasure-data.com', 'b1b065f5-1222-4a14-b151-379d49ec39e3', 'John', 'Doe', 'MailPublisher Dummy Data - DO NOT USE'), ('name+test2@treasure-data.com', 'x1b065f5-1222-4a14-b151-379d49ec39e3', 'Janes', 'Doe', 'MailPublisher Dummy Data - DO NOT USE'), ('name+test3@treasure-data.com', 'p1b065f5-1222-4a14-b151-379d49ec39e3', 'Tony', 'Doe', 'MailPublisher Dummy Data - DO NOT USE'), ('name+test4@treasure-data.com', 'o1b065f5-1222-4a14-b151-379d49ec39e3', 'Bill', 'Adam', 'MailPublisher Dummy Data - DO NOT USE'), ('name+test5@treasure-data.com', 't1b065f5-1222-4a14-b151-379d49ec39e3', 'Dan', 'Steve', 'MailPublisher Dummy Data- DO NOT USE') ) tbl ( email, td_global_id, firstname, lastname, company ) ``` or ```SQL SELECT an_email_column AS email, another_phone_column AS phone FROM your_table; ``` 1. Select Export Results. 2. Use an existing integration and select your MailPublisher connection. 3. Complete the following parameter fields: - **Action mode**: - list_upload: Upload a distribution list - send_email: Book an email delivery in addition to uploading the list. - **Email delivery destination**: - Japan or Worldwide - If the destination is "Japan". the uploaded file is encoded with Shift_JIS character encoding. Else the file is encoded with UTF-8. - **File name prefix**: (optional, default: "delivery_list_") : The uploaded file will have this prefix in its file name. - **Draft ID**: (required with "send_email" mode) ID of the draft to use for email delivery. This can be checked on the MailPublisher console. - **List ID**: (optional) : ID of the file which will override the data. - **Use immediate email delivery**: Check if you want to send an email immediately - Be careful when using this option, email delivery settings cannot be tested at this stage. - **Booking date time**: (required unless "immediate delivery" mode) Sends an email. The email is sent out at least 10 minutes after the output job is run. Its format must be "YYYY-MM-DD HH:mm" such as "2018-09-18 12:00" - **Booking timezone**: Timezone for booking date time. ### (Optional) Schedule Query Export Jobs You can use Scheduled Jobs with Result Export to periodically write the output result to a target destination that you specify. Treasure Data's scheduler feature supports periodic query execution to achieve high availability. When two specifications provide conflicting schedule specifications, the specification requesting to execute more often is followed while the other schedule specification is ignored. For example, if the cron schedule is `'0 0 1 * 1'`, then the 'day of month' specification and 'day of week' are discordant because the former specification requires it to run every first day of each month at midnight (00:00), while the latter specification requires it to run every Monday at midnight (00:00). The latter specification is followed. #### Scheduling your Job Using TD Console 1. Navigate to **Data Workbench > Queries** 2. Create a new query or select an existing query. 3. Next to **Schedule**, select None. ![](/assets/image2021-1-15_17-28-51.f1b242f6ecc7666a0097fdf37edd1682786ec11ef80eff68c66f091bc405c371.0f87d8d4.png) 4. In the drop-down, select one of the following schedule options: ![](/assets/image2021-1-15_17-29-47.45289a1c99256f125f4d887e501e204ed61f02223fde0927af5f425a89ace0c0.0f87d8d4.png) | Drop-down Value | Description | | --- | --- | | Custom cron... | Review [Custom cron... details](#custom-cron-details). | | @daily (midnight) | Run once a day at midnight (00:00 am) in the specified time zone. | | @hourly (:00) | Run every hour at 00 minutes. | | None | No schedule. | #### Custom cron... Details ![](/assets/image2021-1-15_17-30-23.0f94a8aa5f75ea03e3fec0c25b0640cd59ee48d1804a83701e5f2372deae466c.0f87d8d4.png) | **Cron Value** | **Description** | | --- | --- | | `0 * * * *` | Run once an hour. | | `0 0 * * *` | Run once a day at midnight. | | `0 0 1 * *` | Run once a month at midnight on the morning of the first day of the month. | | "" | Create a job that has no scheduled run time. | ``` * * * * * - - - - - | | | | | | | | | +----- day of week (0 - 6) (Sunday=0) | | | +---------- month (1 - 12) | | +--------------- day of month (1 - 31) | +-------------------- hour (0 - 23) +------------------------- min (0 - 59) ``` The following named entries can be used: - Day of Week: sun, mon, tue, wed, thu, fri, sat. - Month: jan, feb, mar, apr, may, jun, jul, aug, sep, oct, nov, dec. A single space is required between each field. The values for each field can be composed of: | Field Value | Example | Example Description | | --- | --- | --- | | A single value, within the limits displayed above for each field. | | | | A wildcard `'*'` to indicate no restriction based on the field. | `'0 0 1 * *'` | Configures the schedule to run at midnight (00:00) on the first day of each month. | | A range `'2-5'`, indicating the range of accepted values for the field. | `'0 0 1-10 * *'` | Configures the schedule to run at midnight (00:00) on the first 10 days of each month. | | A list of comma-separated values `'2,3,4,5'`, indicating the list of accepted values for the field. | `0 0 1,11,21 * *'` | Configures the schedule to run at midnight (00:00) every 1st, 11th, and 21st day of each month. | | A periodicity indicator `'*/5'` to express how often based on the field's valid range of values a schedule is allowed to run. | `'30 */2 1 * *'` | Configures the schedule to run on the 1st of every month, every 2 hours starting at 00:30. `'0 0 */5 * *'` configures the schedule to run at midnight (00:00) every 5 days starting on the 5th of each month. | | A comma-separated list of any of the above except the `'*'` wildcard is also supported `'2,*/5,8-10'`. | `'0 0 5,*/10,25 * *'` | Configures the schedule to run at midnight (00:00) every 5th, 10th, 20th, and 25th day of each month. | 1. (Optional) You can delay the start time of a query by enabling the Delay execution. ### Execute the Query Save the query with a name and run, or just run the query. Upon successful completion of the query, the query result is automatically exported to the specified destination. Scheduled jobs that continuously fail due to configuration errors may be disabled on the system side after several notifications. (Optional) You can delay the start time of a query by enabling the Delay execution. 1. Review results in the MailPublisher Smart Console for your new email delivery list. # (Optional) Configure Export Results in Workflow Within Treasure Workflow, you can specify the use of this data connector to export data. Learn more at [Exporting Data with Parameters](https://docs.treasuredata.com/display/public/PD/Exporting+Data+with+Parameters).