### GET /v1/templates/{start}/{length} Source: https://www.smtpeter.com/en/documentation/rest-templates Retrieves a list of all templates. Use the start and length parameters to limit the number of templates returned. The response is a JSON array containing template IDs and names. ```APIDOC ## GET /v1/templates/{start}/{length} ### Description Retrieves a list of all templates. Use the start and length parameters to limit the number of templates returned. The response is a JSON array containing template IDs and names. ### Method GET ### Endpoint https://www.smtpeter.com/v1/templates/{start}/{length} ### Parameters #### Path Parameters - **start** (integer) - Required - The starting index for the list of templates. - **length** (integer) - Required - The number of templates to return. ### Response #### Success Response (200) - **id** (integer) - The unique identifier of the template. - **name** (string) - The name of the template. #### Response Example [ { "id" : 1, "name" : "Test email" }, { "id" : 2, "name" : "Test 123" } ] ``` -------------------------------- ### Templates list JSON response Source: https://www.smtpeter.com/en/documentation/rest-templates Example JSON array returned by the GET call to /v1/templates. Contains template id and name for each template. ```json [ { "id" : 1, "name" : "Test email" }, { "id" : 2, "name" : "Test 123" } ] ``` -------------------------------- ### Example of formatted foreach loop Source: https://www.smtpeter.com/en/documentation/personalization This is the example mentioned in the text that prints out names of players in a soccer team. The exact code is not shown, but the output is displayed. ```text Ronaldo Messi Ibrahimovic ``` -------------------------------- ### Retrieve templates list URL Source: https://www.smtpeter.com/en/documentation/rest-templates HTTP GET call to retrieve the list of templates. The {start} and {length} parameters limit the timeframe. Requires an API key. ```http https://www.smtpeter.com/v1/templates/{start}/{length} ``` -------------------------------- ### Example JSON response for log files per date Source: https://www.smtpeter.com/en/documentation/rest-logfiles Example response from the logfiles method with a date parameter, returning a list of log file names for that date. ```json [ "attempts.2016-03-20.log", "clicks.2016-03-20.log", "opens.2016-03-20.log", "dmarc.2016-03-20.log" ] ``` -------------------------------- ### Example JSON response for available dates Source: https://www.smtpeter.com/en/documentation/rest-logfiles Example response from the logfiles method without parameters, returning a JSON array of dates in UTC. ```json [ "2016-03-20", "2016-03-21", "2016-03-22" ] // UTC time ``` -------------------------------- ### SMTP API DSN parameters example Source: https://www.smtpeter.com/en/documentation/bounce-handling Shows how to pass DSN parameters using the SMTP API with MAIL FROM and RCPT TO commands. The example includes the server responses '250 sender ok' and '250 recipient ok'. ```smtp MAIL FROM: RET=HDRS ENVID=yourid 250 sender ok RCPT TO: NOTIFY=SUCCESS ORCPT=rfc822;bob@example.com 250 recipient ok ``` -------------------------------- ### JSON address format example Source: https://www.smtpeter.com/en/documentation/rest-send-json Demonstrates flexible address notation for 'from', 'to', and 'cc' fields, including support for display names and arrays. ```json { "from": "info@example.com", "to": [ "one@example.com", "two@example.com", "\"Number three\" , info@example.com" ], "cc": "John Doe " } ``` -------------------------------- ### GET /v1/logfiles Source: https://www.smtpeter.com/en/documentation/rest-logfiles Retrieves an overview of all available dates for which log files are stored. ```APIDOC ## GET /v1/logfiles ### Description Retrieves an overview of all available dates for which log files are stored. ### Method GET ### Endpoint https://www.smtpeter.com/v1/logfiles ### Response #### Success Response (200) Returns a JSON array of dates in UTC time. #### Response Example [ "2016-03-20", "2016-03-21", "2016-03-22" ] ``` -------------------------------- ### Get events by template Source: https://www.smtpeter.com/en/documentation/rest-events Retrieves events for a specific template for the last monthly period. Optionally specify the start and/or end option for a different period, and filter on tags with the tags option. ```text https://www.smtpeter.com/v1/events/template/TEMPLATE ``` -------------------------------- ### GET /v1/logfiles/DATE Source: https://www.smtpeter.com/en/documentation/rest-logfiles Retrieves a list of all log files available for a specific date. ```APIDOC ## GET /v1/logfiles/DATE ### Description Retrieves a list of all log files available for a specific date. ### Method GET ### Endpoint https://www.smtpeter.com/v1/logfiles/DATE ### Parameters #### Path Parameters - **DATE** (string) - Required - The date in "YYYY-MM-DD" format. ### Response #### Success Response (200) Returns a JSON array of log file names. #### Response Example [ "attempts.2016-03-20.log", "clicks.2016-03-20.log", "opens.2016-03-20.log", "dmarc.2016-03-20.log" ] ``` -------------------------------- ### GET /v1/logfiles/FILENAME Source: https://www.smtpeter.com/en/documentation/rest-logfiles Downloads a single log file. ```APIDOC ## GET /v1/logfiles/FILENAME ### Description Downloads a single log file. ### Method GET ### Endpoint https://www.smtpeter.com/v1/logfiles/FILENAME ### Parameters #### Path Parameters - **FILENAME** (string) - Required - The name of the log file to download. ### Response #### Success Response (200) Returns the log file content. ``` -------------------------------- ### GET /v1/events/template/{TEMPLATE} Source: https://www.smtpeter.com/en/documentation/rest-events Retrieves events for a specific template for the last monthly period. You can specify a different period using the start and end options, and optionally filter on tags. ```APIDOC ## GET /v1/events/template/{TEMPLATE} ### Description Retrieves event information for a particular template for the last monthly period. You can specify a different period using the start and end options, and optionally filter on tags. ### Method GET ### Endpoint https://www.smtpeter.com/v1/events/template/{TEMPLATE} ### Parameters #### Path Parameters - **TEMPLATE** (string) - Required - The id of the template you are interested in. #### Query Parameters - **start** (string) - Optional - Start date for the period to retrieve events. - **end** (string) - Optional - End date for the period to retrieve events. - **tags** (string) - Optional - Comma-separated list of tags to filter events. ### Response #### Success Response (200) Returns a JSON object containing event information for the specified template. #### Response Example { "events": [] } ``` -------------------------------- ### Send template with attachment URL Source: https://www.smtpeter.com/en/documentation/rest-send-modified Let SMTPeter download the attachment from a URL. Note the URL in the example contains a typo (http:://). ```http POST /v1/send?access_token={YOUR_API_TOKEN} HTTP/1.0 Host: www.smtpeter.com Content-Type: application/json Content-Length: 152 { "recipient": "john@doe.com", "template": 12, "attachments": [{ "url": "http:://example.com/path/to/document.pdf", }] } ``` -------------------------------- ### Example MIME message Source: https://www.smtpeter.com/en/documentation/rest-mime Shows a minimal MIME message that could be passed in the 'mime' property. It includes a header and a plain-text body separated by an empty line. ```text MIME-Version: 1.0 From: To: "John Doe" Subject: This is the subject line Date: Thu, 23 May 2019 15:07:11 +0200 Content-Type: text/html Hello John, This is a very minimal e-mail message. Cheers, Peter ``` -------------------------------- ### Get events by tags Source: https://www.smtpeter.com/en/documentation/rest-events Retrieves events for one or multiple tags. The first URL retrieves events for a single tag; the second extends the call to filter on multiple tags. The returned JSON only contains information for messages that have all tags set. Optionally specify the start and/or end option for a different period. ```text https://www.smtpeter.com/v1/events/tags/TAG ``` ```text https://www.smtpeter.com/v1/events/tags/TAG1;TAG2;TAG3;... ``` -------------------------------- ### GET /v1/dkimkey/{domain}/algorithm Source: https://www.smtpeter.com/en/documentation/rest-dkim Retrieves the signing algorithm for the specified domain as plain text. ```APIDOC ## GET /v1/dkimkey/{domain}/algorithm ### Description Retrieves the signing algorithm for the specified domain as plain text. ### Method GET ### Endpoint https://www.smtpeter.com/v1/dkimkey/{domain}/algorithm ### Parameters #### Path Parameters - **domain** (string) - Required - The domain for which to retrieve the algorithm. ### Response #### Success Response (200) - **body** (string) - The algorithm (e.g., sha256), returned as text/plain. #### Response Example sha256 ``` -------------------------------- ### Send template with convenience properties Source: https://www.smtpeter.com/en/documentation/rest-send-modified Use convenience properties like subject and from to directly override template values. This example sends template 12 with a different subject and from address. ```http POST /v1/send?access_token={YOUR_API_TOKEN} HTTP/1.0 Host: www.smtpeter.com Content-Type: application/json Content-Length: 116 { "recipient": "john@doe.com", "template": 12, "subject": "alternative subject line", "from": "Sender Name " } ``` -------------------------------- ### Example hyperlink prevented by preventscam Source: https://www.smtpeter.com/en/documentation/rest-send-advanced Example hyperlink that the preventscam option prevents SMTPeter from modifying. ```html www.example.com ``` -------------------------------- ### Create template POST request and response Source: https://www.smtpeter.com/en/documentation/rest-templates Example POST request to create a template and the corresponding HTTP response. The request includes the template name in JSON. The response includes a 201 Created status, a Location header with the new template URL, and a JSON object with the template ID. ```http POST /v1/template/html?access_token=yourtoken Host: www.smtpeter.com Content-Type: application/json { "name" : "template..." } HTTP/1.1 201 Created Location: https://www.smtpeter.com/v1/template/2/html?access_token=yourtoken Content-Type: application/json { "id" : 2 } ``` -------------------------------- ### GET /v1/logfiles/FILENAME/xml Source: https://www.smtpeter.com/en/documentation/rest-logfiles Downloads a single log file in XML format. ```APIDOC ## GET /v1/logfiles/FILENAME/xml ### Description Downloads a single log file in XML format. ### Method GET ### Endpoint https://www.smtpeter.com/v1/logfiles/FILENAME/xml ### Parameters #### Path Parameters - **FILENAME** (string) - Required - The name of the log file. ### Response #### Success Response (200) Returns the log file content in XML format. ``` -------------------------------- ### GET /v1/dns/{domain}/recommended Source: https://www.smtpeter.com/en/documentation/rest-dns Retrieves the recommended DNS records that should be copied to the user's DNS server. These records typically use CNAMEs pointing to SMTPeter's domain for easier management. ```APIDOC ## GET /v1/dns/{domain}/recommended ### Description Returns an array of DNS records that the user should copy to their DNS server. The records are recommended by SMTPeter and often use CNAMEs to point to SMTPeter's DNS records. ### Method GET ### Endpoint https://www.smtpeter.com/v1/dns/{domain}/recommended ### Parameters #### Path Parameters - **domain** (string) - Required - The sender domain for which to retrieve DNS recommendations. ### Response #### Success Response (200) Returns a JSON array of DNS record objects. Each object contains: - **name** (string) - The DNS record name. - **type** (string) - The DNS record type (e.g., CNAME, MX, TXT). - **value** (string) - The value for the DNS record. #### Response Example [ { "name": "zero._domainkey.example.com", "type": "CNAME", "value": "dkimX0.smtpeter.com" }, { "name": "one._domainkey.example.com", "type": "CNAME", "value": "dkimX1.smtpeter.com" }, { "name": "two._domainkey.example.com", "type": "CNAME", "value": "dkimX2.smtpeter.com" }, { "name": "example.com", "type": "MX", "value": "0 mail.smtpeter.com" }, { "name": "clicks.example.com", "type": "CNAME", "value": "clicks.smtpeter.com" }, { "name": "example.com", "type": "TXT", "value": "v=spf1 include:spfX.smtpeter.com -all" }, { "name": "_dmarc.example.com", "type": "CNAME", "value": "dmarcX.smtpeter.com" } ] ``` -------------------------------- ### GET /v1/logfiles/FILENAME/header Source: https://www.smtpeter.com/en/documentation/rest-logfiles Downloads the header of a single log file. ```APIDOC ## GET /v1/logfiles/FILENAME/header ### Description Downloads the header of a single log file. ### Method GET ### Endpoint https://www.smtpeter.com/v1/logfiles/FILENAME/header ### Parameters #### Path Parameters - **FILENAME** (string) - Required - The name of the log file. ### Response #### Success Response (200) Returns the header of the log file. ``` -------------------------------- ### GET /v1/logfiles/FILENAME/json Source: https://www.smtpeter.com/en/documentation/rest-logfiles Downloads a single log file in JSON format. ```APIDOC ## GET /v1/logfiles/FILENAME/json ### Description Downloads a single log file in JSON format. ### Method GET ### Endpoint https://www.smtpeter.com/v1/logfiles/FILENAME/json ### Parameters #### Path Parameters - **FILENAME** (string) - Required - The name of the log file. ### Response #### Success Response (200) Returns the log file content in JSON format. ``` -------------------------------- ### HTML with style block Source: https://www.smtpeter.com/en/documentation/inline-css Example HTML with a style block in the head that SMTPeter will convert to inline styles when the inline-css feature is enabled. ```html ``` -------------------------------- ### GET /v1/dkimkey/{domain}/selector Source: https://www.smtpeter.com/en/documentation/rest-dkim Retrieves the DKIM selector for the specified domain as plain text. ```APIDOC ## GET /v1/dkimkey/{domain}/selector ### Description Retrieves the DKIM selector for the specified domain as plain text. ### Method GET ### Endpoint https://www.smtpeter.com/v1/dkimkey/{domain}/selector ### Parameters #### Path Parameters - **domain** (string) - Required - The domain for which to retrieve the selector. ### Response #### Success Response (200) - **body** (string) - The selector (e.g., zero), returned as text/plain. #### Response Example zero ``` -------------------------------- ### Example HTTP header with SMTPeter webhook security headers Source: https://www.smtpeter.com/en/documentation/webhook-security Shows the format of an HTTP request header that SMTPeter sends to your webhook endpoint. It includes the Digest, X-Copernica-ID, and Signature headers. Use this to understand the expected header structure and values for verification. ```http POST /path/to/your/script HTTP/1.1 Host: yourserver.yourdomain.com Date: Sun, 05 Jan 2014 21:31:40 GMT X-Copernica-ID: environment-1234 Digest: SHA-256=X48E9qOokqqrvdts8nOJRJN3OWDUoyWxBf7kbu9DBPE= Content-Type: application/json Content-Length: 328746 X-Nonce: fsd9f2 Signature: keyId="one._domainkey.copernica.com",algorithm="rsa-sha256", headers="(request-target) Host Date Content-length Content-type X-Copernica-ID Digest X-nonce" signature="vSdrb+dS3EceC9bcwHSo4MlyKS59iFIrhgYkz8+oVLEEzmYZZvRs 8rgOp+63LEM3v+MFHB32NfpB2bEKBIvB1q52LaEUHFv120V01IL+TAD48XaERZF ukWgHoBTLMhYS2Gb51gWxpeIq8knRmPnYePbF5MOkR0Zkly4zKH7s1dE=" ``` -------------------------------- ### GET /v1/dns/{domain}/status Source: https://www.smtpeter.com/en/documentation/rest-dns Checks whether the user's DNS records are correctly set up by comparing them with the recommended settings. Returns a status object indicating the state of each DNS record type. ```APIDOC ## GET /v1/dns/{domain}/status ### Description Queries the user's DNS records and compares them with the recommended settings. Returns a status object with the state of DMARC, DKIM, SPF, MX, A, CAA, and validation. ### Method GET ### Endpoint https://www.smtpeter.com/v1/dns/{domain}/status ### Parameters #### Path Parameters - **domain** (string) - Required - The sender domain to check. ### Response #### Success Response (200) Returns a JSON object with the following properties: - **dmarc** (string) - Status of DMARC record: "ok" or "error". - **dkim** (string) - Status of DKIM record: "ok" or "error". - **spf** (string) - Status of SPF record: "ok" or "error". - **mx** (string) - Status of MX record: "ok" or "error". - **a** (string) - Status of A record: "ok" or "error". - **caa** (string) - Status of CAA record: "ok" or "error". - **validation** (string) - Indicates whether the sender domain has been validated: "ok" or "error". #### Response Example { "dmarc": "ok", "dkim": "error", "spf": "ok", "mx": "ok", "a": "ok", "caa": "ok", "validation": "ok" } ``` -------------------------------- ### Adding custom x-* headers to email JSON Source: https://www.smtpeter.com/en/documentation/rest-send-json Use the 'extra' property to include custom headers. Custom headers must start with the 'x-' prefix to avoid conflicts. ```json { "subject": "this is the subject line", "html": " .... ", "text": "text version of the email", "extra": { "x-my-identifier": "abcdefg", "x-custom-property": "custom" } } ``` -------------------------------- ### DNS recommendations JSON response Source: https://www.smtpeter.com/en/documentation/rest-dns Example JSON array returned by the recommended and self-hosted API calls. Contains DNS records to copy to your DNS server, including CNAME, MX, TXT, and DMARC records. ```json [ { "name": "zero._domainkey.example.com", "type": "CNAME", "value": "dkimX0.smtpeter.com" }, { "name": "one._domainkey.example.com", "type": "CNAME", "value": "dkimX1.smtpeter.com" }, { "name": "two._domainkey.example.com", "type": "CNAME", "value": "dkimX2.smtpeter.com" }, { "name": "example.com", "type": "MX", "value": "0 mail.smtpeter.com" }, { "name": "clicks.example.com", "type": "CNAME", "value": "clicks.smtpeter.com" }, { "name": "example.com", "type": "TXT", "value": "v=spf1 include:spfX.smtpeter.com -all" }, { "name": "_dmarc.example.com", "type": "CNAME", "value": "dmarcX.smtpeter.com" } ] ``` -------------------------------- ### GET /v1/dkimkey/{domain}/publickey Source: https://www.smtpeter.com/en/documentation/rest-dkim Retrieves the public key for the specified domain as plain text. ```APIDOC ## GET /v1/dkimkey/{domain}/publickey ### Description Retrieves the public key for the specified domain as plain text. ### Method GET ### Endpoint https://www.smtpeter.com/v1/dkimkey/{domain}/publickey ### Parameters #### Path Parameters - **domain** (string) - Required - The domain for which to retrieve the public key. ### Response #### Success Response (200) - **body** (string) - The public key in PEM format, returned as text/plain. #### Response Example -----BEGIN PUBLIC KEY-----\n...\n-----END PUBLIC KEY----- ``` -------------------------------- ### POST /v1/send request with JSON body Source: https://www.smtpeter.com/en/documentation/rest-send-json Example of a POST request to the SMTPeter API including the access token and a JSON payload defining email properties. ```http POST /v1/send?access_token={YOUR_API_TOKEN} HTTP/1.0 Host: www.smtpeter.com Content-Type: application/json Content-Length: 7391 { "recipient": "john@doe.com", "subject": "This is a test mail", "from": "info@example.com", "text": "This is the messge body...", "html": "..." } ``` -------------------------------- ### GET /v1/logfiles/{filename} Source: https://www.smtpeter.com/en/documentation/rest-logfiles Downloads a log file in CSV format. The filename is the name of the log file, e.g., attempts.2016-03-20.log. The response is a CSV file without variable names. ```APIDOC ## GET /v1/logfiles/{filename} ### Description Downloads a log file in CSV format. The filename is the name of the log file, e.g., attempts.2016-03-20.log. The response is a CSV file without variable names. ### Method GET ### Endpoint https://www.smtpeter.com/v1/logfiles/{filename} ### Parameters #### Path Parameters - **filename** (string) - Required - The name of the log file to download. ### Response #### Success Response (200) - CSV file content without variable names. #### Response Example attempts.2016-03-20.log content in CSV format. ``` -------------------------------- ### Example of safe link text Source: https://www.smtpeter.com/en/documentation/statistics This HTML anchor tag shows a link with text that matches the destination, avoiding the scam warning. ```html my website ``` -------------------------------- ### DKIM key JSON response Source: https://www.smtpeter.com/en/documentation/rest-dkim Example JSON response from the first endpoint, showing the current key's selector, algorithm, and public key. ```json { "selector": "zero", "algorithm": "sha256", "public": "-----BEGIN PUBLIC KEY-----\n...\n-----END PUBLIC KEY-----" } ``` -------------------------------- ### GET /v1/dmarc/{DATE}/{FROM}/{FOR} Source: https://www.smtpeter.com/en/documentation/rest-dmarc Retrieves the first DMARC report for a specific date, from-domain, and for-domain combination. ```APIDOC ## GET /v1/dmarc/{DATE}/{FROM}/{FOR} ### Description Retrieves the first DMARC report for a specific date, from-domain, and for-domain combination. ### Method GET ### Endpoint https://www.smtpeter.com/v1/dmarc/{DATE}/{FROM}/{FOR} ### Parameters #### Path Parameters - **DATE** (string) - Required - The date of the report in the form YYYY-MM-DD. - **FROM** (string) - Required - The domain that sent the report. - **FOR** (string) - Required - The domain for which the report is sent. ### Response #### Success Response (200) - **body** (XML) - The DMARC report as an XML document. #### Response Example ... ``` -------------------------------- ### Open main.cf with nano Source: https://www.smtpeter.com/en/documentation/postfix Opens the Postfix main configuration file for editing. ```bash $ sudo nano /etc/postfix/main.cf ``` -------------------------------- ### GET /v1/attachments/MESSAGEID/NUMBER Source: https://www.smtpeter.com/en/documentation/rest-messages Downloads an attachment by its rank (starting from zero). ```APIDOC ## GET /v1/attachments/MESSAGEID/NUMBER ### Description Downloads an attachment by its rank. ### Method GET ### Endpoint https://www.smtpeter.com/v1/attachments/MESSAGEID/NUMBER ### Parameters #### Path Parameters - **MESSAGEID** (string) - Required - The unique message ID of the email. - **NUMBER** (integer) - Required - The rank of the attachment, starting from zero. ### Response #### Success Response (200) - **body** - The attachment file content. #### Response Example (binary content) ``` -------------------------------- ### Update template PUT request and response Source: https://www.smtpeter.com/en/documentation/rest-templates Example PUT request to update an existing template and the corresponding HTTP response. The request includes the template ID in JSON. The response includes a 201 Created status, a Location header, and a JSON object with the template ID. ```http PUT /v1/template/html?access_token=yourtoken Host: www.smtpeter.com Content-Type: application/json { "id" : 2 } HTTP/1.1 201 Created Location: https://www.smtpeter.com/v1/template/2/html?access_token=yourtoken Content-Type: application/json { "id" : 2 } ``` -------------------------------- ### Example of scam warning link Source: https://www.smtpeter.com/en/documentation/statistics This HTML anchor tag shows a link that triggers a scam warning in some email programs because the visible text (www.example.com) differs from the actual URL (clicks.smtpeter.com). ```html www.example.com ``` -------------------------------- ### GET /v1/domain/{domain} Source: https://www.smtpeter.com/en/documentation/rest-sender-domains Retrieves all configuration properties for a specific sender domain, including IP addresses and DMARC report recipients. ```APIDOC ## [GET] /v1/domain/{domain} ### Description Retrieves all configuration properties for a specific sender domain, including the IP addresses assigned to it and the email addresses that receive DMARC reports. ### Method GET ### Endpoint https://www.smtpeter.com/v1/domain/example.com ### Parameters #### Path Parameters - **domain** (string) - Required - The sender domain name to retrieve information for. ### Response #### Success Response (200) - **name** (string) - The sender domain name. - **approved** (boolean) - Whether the domain is approved. - **bounces** (string) - The bounce domain. - **tracking** (string) - The tracking domain. - **https** (boolean) - Whether HTTPS is enabled. - **ips** (array of strings) - IP addresses assigned to the domain. - **policy** (string) - DMARC policy (none, quarantine, or reject). - **percentage** (integer) - The percentage of messages to which the policy applies. - **startdate** (string) - The start date of the policy. - **enddate** (string) - The end date of the policy. - **addresses** (array of strings) - Email addresses that receive DMARC reports. #### Response Example ```json { "name": "example.com", "approved": true, "bounces": "bounces.example.com", "tracking": "tracking.example.com", "https": false, "ips": ["1.2.3.4", "2.3.4.5"], "policy": "none|quarantine|reject", "percentage": 50, "startdate": "2016-06-14", "enddate": "2016-06-14", "addresses": ["dmarc@smtpeter.com"] } ``` ``` -------------------------------- ### GET /v1/embeds/MESSAGEID/NUMBER Source: https://www.smtpeter.com/en/documentation/rest-messages Downloads embedded content by its rank (starting from zero). ```APIDOC ## GET /v1/embeds/MESSAGEID/NUMBER ### Description Downloads embedded content by its rank. ### Method GET ### Endpoint https://www.smtpeter.com/v1/embeds/MESSAGEID/NUMBER ### Parameters #### Path Parameters - **MESSAGEID** (string) - Required - The unique message ID of the email. - **NUMBER** (integer) - Required - The rank of the embedded content, starting from zero. ### Response #### Success Response (200) - **body** - The embedded content file. #### Response Example (binary content) ``` -------------------------------- ### Send email and retrieve message text with SMTPeter PHP class Source: https://www.smtpeter.com/en/documentation/php-example Constructs an SMTPeter object with a token, sends an email via the 'send' method, and retrieves the text version of a message using the 'text' method. The example includes placeholders for the token and message ID. ```php // Your token $token = "00000"; // construct SMTPeter object with your token $object = new SMTPeter($token); // run the HTTP POST call for the "send" method $output = $object->post("send", array( 'envelope' => 'sender@example.com', // The sending email address 'recipient' => 'receiver@example.com', // The receiving email address 'subject' => 'This is the mail subject', // MIME's subject 'from' => 'sender@example.com', // MIME's sending email address 'to' => 'receiver@example.com', // MIME's receiving email addres 'text' => 'This is the text version', // Text and HTML bodies 'html' => 'This is the html version.' )); // run the HTTP GET call for the "text" method $messageID = "your message id"; $dates = $object->get("text/$messageID"); print_r($dates); ``` -------------------------------- ### GET /v1/events/template/{TEMPLATE} Source: https://www.smtpeter.com/en/documentation/rest-events Retrieves events for a specific template. This endpoint allows you to fetch all logged events associated with a particular template. ```APIDOC ## GET /v1/events/template/{TEMPLATE} ### Description Retrieves events for a specific template. This endpoint allows you to fetch all logged events associated with a particular template. ### Method GET ### Endpoint https://www.smtpeter.com/v1/events/template/{TEMPLATE} ### Parameters #### Path Parameters - **TEMPLATE** (string) - Required - The template identifier for which to retrieve events. #### Query Parameters - **start** (string) - Optional - The start date (yyyy-mm-dd) from which to retrieve events. - **end** (string) - Optional - The exclusive end date (yyyy-mm-dd) until which to retrieve events. - **tags** (string) - Optional - Optional tags to filter for. ### Response #### Success Response (200) Returns the events matching the specified criteria. ``` -------------------------------- ### GET events by message ID Source: https://www.smtpeter.com/en/documentation/rest-events GET request to retrieve events for a specific message ID. The `MESSAGEID` placeholder should be replaced with the actual message ID. Events are available up to one month after sending; use `start` and/or `end` options for a different period. ```http https://www.smtpeter.com/v1/events/messageid/MESSAGEID ``` -------------------------------- ### Configure Postfix relay settings in main.cf Source: https://www.smtpeter.com/en/documentation/postfix Update or add these settings to enable SASL authentication, use STARTTLS, set the relay host to SMTPeter, and specify CA certificates. If you used a non-default port in sasl_passwd, use the same port in relayhost. ```plaintext # enable SASL authentication smtp_sasl_auth_enable = yes # tell Postfix where the credentials are stored smtp_sasl_password_maps = hash:/etc/postfix/sasl_passwd smtp_sasl_security_options = noanonymous # use STARTTLS for encryption smtp_use_tls = yes # specify SMTP relay host relayhost = [mail.smtpeter.com]:587 # where to find CA certificates smtp_tls_CAfile = /etc/ssl/certs/ca-certificates.crt ``` -------------------------------- ### GET list of all sender domains Source: https://www.smtpeter.com/en/documentation/rest-sender-domains Lists all sender domains that have configuration settings in SMTPeter. The response is an array of JSON objects, each containing the same properties as the single-domain response, including 'ips' and 'addresses'. ```http https://www.smtpeter.com/v1/domains ``` ```json [ { "name": "yoursenderdomain.com", "approved": true, "bounces": "bounces.yoursenderdomain.com", "tracking": "tracking.yoursenderdomain.com", "https": true, "ips": ["1.2.3.4", "2.3.4.5"], "policy": "none|quarantine|reject", "percentage": 100, "startdate": "2016-01-01", "enddate": "2016-01-18", "addresses": ["dmarc@smtpeter.com"] }, { "approved": true, "name": "example.com", "bounces": "bounces.example.com", "tracking": "tracking.example.com", "https": false, "ips": ["1.2.3.4", "2.3.4.5"], "policy": "none|quarantine|reject", "percentage": 50, "startdate": "2016-06-14", "enddate": "2016-06-14", "addresses": ["dmarc@smtpeter.com"] } ] ``` -------------------------------- ### GET /v1/template/{ID}/{format} Source: https://www.smtpeter.com/en/documentation/rest-templates Requests a specific template by its ID or name. The format parameter determines the response format (JSON, HTML, Webversion, MIME, Embedded, or Text). Personalization variables can be added as query parameters. ```APIDOC ## GET /v1/template/{ID}/{format} ### Description Requests a specific template by its ID or name. The format parameter determines the response format (JSON, HTML, Webversion, MIME, Embedded, or Text). Personalization variables can be added as query parameters. ### Method GET ### Endpoint https://www.smtpeter.com/v1/template/{ID}/{format} ### Parameters #### Path Parameters - **ID** (string) - Required - The unique identifier or name of the template. - **format** (string) - Optional - The format of the returned content. Default is JSON. Supported values: JSON, HTML, Webversion, MIME, Embedded, Text. #### Query Parameters - **access_token** (string) - Required - Your API key. - Additional personalization variables can be added as query parameters. ### Response #### Success Response (200) Returns the template content in the requested format. ``` -------------------------------- ### Open sasl_passwd file with nano Source: https://www.smtpeter.com/en/documentation/postfix Opens the existing /etc/postfix/sasl_passwd file for editing. If the file does not exist, create it. ```bash $ sudo nano /etc/postfix/sasl_passwd ``` -------------------------------- ### Request specific template URL Source: https://www.smtpeter.com/en/documentation/rest-templates HTTP GET call to request a specific template by ID. The {format} parameter specifies the response format (JSON, HTML, Webversion, MIME, Embedded, Text). Default is JSON. ```http https://www.smtpeter.com/v1/template/{ID}/{format} ``` -------------------------------- ### GET /v1/events/email/{EMAILADDRESS} Source: https://www.smtpeter.com/en/documentation/rest-events Retrieves events for a specific email address for the last monthly period. You can specify a different period using the start and end options, and optionally filter on tags. ```APIDOC ## GET /v1/events/email/{EMAILADDRESS} ### Description Retrieves event information for a particular email address for the last monthly period. You can specify a different period using the start and end options, and optionally filter on tags. ### Method GET ### Endpoint https://www.smtpeter.com/v1/events/email/{EMAILADDRESS} ### Parameters #### Path Parameters - **EMAILADDRESS** (string) - Required - The email address you are interested in. #### Query Parameters - **start** (string) - Optional - Start date for the period to retrieve events. - **end** (string) - Optional - End date for the period to retrieve events. - **tags** (string) - Optional - Comma-separated list of tags to filter events. ### Response #### Success Response (200) Returns a JSON object containing event information for the specified email address. #### Response Example { "events": [] } ``` -------------------------------- ### GET /v1/events/tags/{TAG} Source: https://www.smtpeter.com/en/documentation/rest-events Retrieves events for one or more tags for the last monthly period. You can specify a different period using the start and end options. Multiple tags can be provided separated by semicolons. ```APIDOC ## GET /v1/events/tags/{TAG} ### Description Retrieves event information for one or more tags for the last monthly period. You can specify a different period using the start and end options. Multiple tags can be provided separated by semicolons. ### Method GET ### Endpoint https://www.smtpeter.com/v1/events/tags/{TAG} ### Parameters #### Path Parameters - **TAG** (string) - Required - The tag you are interested in. For multiple tags, use semicolons: TAG1;TAG2;TAG3;... #### Query Parameters - **start** (string) - Optional - Start date for the period to retrieve events. - **end** (string) - Optional - End date for the period to retrieve events. ### Response #### Success Response (200) Returns a JSON object containing event information for messages that have all specified tags set. #### Response Example { "events": [] } ``` -------------------------------- ### DNS status response JSON Source: https://www.smtpeter.com/en/documentation/rest-dns Example JSON response from the status API call. Shows status for dmarc, dkim, spf, mx, a, caa, and validation fields, with possible values 'ok' or 'error'. ```json { "dmarc": "ok", "dkim": "error", "spf": "ok", "mx": "ok", "a": "ok", "caa": "ok", "validation": "ok" } ``` -------------------------------- ### Retrieve text, HTML, and headers of a sent message Source: https://www.smtpeter.com/en/documentation/rest-messages Use these methods to get the text, HTML, or full original headers of a sent message. The returned data is in text/plain format. ```text https://www.smtpeter.com/v1/text/MESSAGEID https://www.smtpeter.com/v1/html/MESSAGEID https://www.smtpeter.com/v1/header/MESSAGEID ``` -------------------------------- ### GET /v1/logfiles/{filename}/xml Source: https://www.smtpeter.com/en/documentation/rest-logfiles Downloads a log file in XML format. The filename is the name of the log file, e.g., attempts.2016-03-20.log. The response is an XML document with a root element containing elements. ```APIDOC ## GET /v1/logfiles/{filename}/xml ### Description Downloads a log file in XML format. The filename is the name of the log file, e.g., attempts.2016-03-20.log. The response is an XML document with a root element containing elements. ### Method GET ### Endpoint https://www.smtpeter.com/v1/logfiles/{filename}/xml ### Parameters #### Path Parameters - **filename** (string) - Required - The name of the log file to download. ### Response #### Success Response (200) - XML document with root element, each contains child elements named after the log file variables. #### Response Example value1 value2 ``` -------------------------------- ### REST API request with inlinecss parameter Source: https://www.smtpeter.com/en/documentation/inline-css Example REST API POST request to send an email with the inlinecss parameter set to true, enabling automatic CSS inlining. ```http POST /send HTTP/1.1 Content-Type: application/json Content-Length: 302 { "envelope": "example@example.org", "recipient": "john@doe.com", "subject": "example subject", "to": "john@doe.com", "from": "example@example.org", "html": "Hello there!", "inlinecss": true } ``` -------------------------------- ### Set myhostname in /etc/postfix/main.cf Source: https://www.smtpeter.com/en/documentation/postfix Required before relaying: set myhostname to your server's fully-qualified domain name (FQDN) in /etc/postfix/main.cf. ```plaintext myhostname = fqdn.yourdomain.com ``` -------------------------------- ### GET /v1/logfiles/{filename}/header Source: https://www.smtpeter.com/en/documentation/rest-logfiles Downloads a log file in CSV format with variable names included on the first line. The filename is the name of the log file, e.g., attempts.2016-03-20.log. The response is a CSV file with a header row. ```APIDOC ## GET /v1/logfiles/{filename}/header ### Description Downloads a log file in CSV format with variable names included on the first line. The filename is the name of the log file, e.g., attempts.2016-03-20.log. The response is a CSV file with a header row. ### Method GET ### Endpoint https://www.smtpeter.com/v1/logfiles/{filename}/header ### Parameters #### Path Parameters - **filename** (string) - Required - The name of the log file to download. ### Response #### Success Response (200) - CSV file content with variable names on the first line. #### Response Example CSV file with header row. ``` -------------------------------- ### JSON link object with {$webversion} in url Source: https://www.smtpeter.com/en/documentation/webversion For emails sent in JSON format, include the {$webversion} tag in the url property of a link object. This example shows a link block that creates a clickable link to the web version. ```json { "type": "link", "label": "View the web version", "link": { "title": "View the web version", "url": "{$webversion}" } } ``` -------------------------------- ### Get events by email address Source: https://www.smtpeter.com/en/documentation/rest-events Retrieves events for a specific email address for the last monthly period. Optionally specify the start and/or end option for a different period, and filter on tags with the tags option. ```text https://www.smtpeter.com/v1/events/email/EMAILADDRESS ``` -------------------------------- ### GET /v1/logfiles/{filename}/json Source: https://www.smtpeter.com/en/documentation/rest-logfiles Downloads a log file in JSON format. The filename is the name of the log file, e.g., attempts.2016-03-20.log. The response is a JSON array containing objects with variable names as properties. ```APIDOC ## GET /v1/logfiles/{filename}/json ### Description Downloads a log file in JSON format. The filename is the name of the log file, e.g., attempts.2016-03-20.log. The response is a JSON array containing objects with variable names as properties. ### Method GET ### Endpoint https://www.smtpeter.com/v1/logfiles/{filename}/json ### Parameters #### Path Parameters - **filename** (string) - Required - The name of the log file to download. ### Response #### Success Response (200) - JSON array of objects, each object has properties named after the log file variables. #### Response Example [{"NAME1": "value1", "NAME2": "value2"}] ``` -------------------------------- ### REST API DSN JSON example Source: https://www.smtpeter.com/en/documentation/bounce-handling Shows how to include DSN parameters in a REST API request to SMTPeter. The 'dsn' object contains 'notify', 'ret', 'envid', and 'orcpt' fields to control bounce notifications. ```json { "envelope": "bounce@yourdomain.com", "recipient": "info@example.com", "mime": "...", "dsn": { "notify": "FAILURE", "ret": "HDRS", "envid": "unique-identifier", "orcpt": "info@example.com" } } ```