Sending Email with Arnica NanoMail

July 4, 2024 by Igor Lozhkin
Arnica NanoMail is a high-performance web service which has been designed to send many emails concurrently. NanoMail operates as a web service accepting POST requests with JSON content, which includes properties of the email to be sent.

The following end point is used to send a single email: 

http://127.0.0.1:3700/email/send/

The posted JSON has the following structure: 

{
"to_addr": "",
"cc_addr": "",
"bcc_addr": "",
"subject": "",
"body": "",
"from_addr": "",
"encoding": "",
"reply_to_addr": "",
"sender_name": "",
"email_source_code": "",
"attachments": [],
"body_format": "",
"mail_format": "",
"priority": nnn,
"message_id": "",
"headers_text": "",
"headers": [],
"dkim_name": ""
}

All properties in JSON are mandatory, however not all require value.

The following is a description of each property:

to_addr - comma-delimited list of email addresses of primary recipients
cc_addr comma-delimited list of email addresses of secondary recipients 
bcc_addr comma-delimited list of email addresses of hidden recipients 
subject - email subject
body - email body
from_addr - sender email address
encoding if empty,  specifies that email body is in clear text format, if value is @base64, specifies that email body is base64-encoded
reply_to_addr - email address the reply is sent to
sender_name - sender name
email_source_code - email source identifier, used to categorize emails when integrated with Arnica EmailServer
attachments - JSON array of attachments
body_format - @html for html format, or @text - for plain text
mail_format - @mime for MIME, or @text for text
priority - values from 1 to 5 (1 - highest priority, 3 - medium, 5 - lowest)
message_id - message unique identifier (usually a GUID value), should not include domain suffix (like @domainname.com)
headers_text - multiple custom email headers in line separated key:value format
headers - multiple custom email headers as JSON array
dkim_name - DKIM identifier, DKIM properties are stored in NanoMail configuration file

After API is executed, it returns response indicating success/failure result.