Mail Sender (New)

This is a Python script for sending emails, which includes various attachment implementations.

Supported Authentication

This integration does not support NTLM authentication. If you are using Exchange as the SMTP server for sending mail and receive the error message: No suitable authentication method found. make sure that you enable Basic Authentication for SMTP authentication in your Exchange environment.

This example shows Basic Authentication on Exchange 2010:

image

Configure Mail Sender on Demisto

  1. Navigate to Settings > Integrations > Servers & Services .
  2. Search for Mail Sender (New).
  3. Click Add instance to create and configure a new integration instance.
    • Name: a textual name for the integration instance
    • Mail server hostname or IP address
    • SMTP Port
    • Credentials
    • Password
    • Sender address : if the sender address is different than the log-in credentials and password, the sender address must have permission to send emails.
    • FQDN : Fully Qualified Domain Name, used in EHLO
    • Use TLS for connection
    • Do not validate server certificate (not secure)
  4. Click Test to validate the URLs, token, and connection.

Commands

  1. Send email: send-mail

1. Send email


Sends an email.

Basic Command

send-mail

Input
Argument Name Description
to Recipient email address
cc Additional recipient email address
bcc Additional recipient email address
subject Subject of the email
body Content of the email in plain text
htmlBody Content of the email in html format
replyTo

If recipient chooses to reply, reply will automatically be sent to this email address

attachIDs Comma-separated list of IDs of war room entries that contain the files you want to attach to the email
attachNames

A comma-separated list of new names, to rename attachments, in correspondence with the order that they were attached to the email.

Examples:

  • To rename first and third file: attachNames=new_fileName1,,new_fileName3
  • To rename second and fifth files: attachNames=,new_fileName2,,,new_fileName5
attachCIDs

A comma-separated list of CIDs to embed attachments inside the email itself

transientFile

Textual name for attached file. Multiple files are supported.

transientFileContent

Content for attached file. Multiple files are supported.

Example:

transientFile.1="t1.txt" transientFileContent.1="test 1" transientFile.2="t3.txt" transientFileContent.2="test 3"

transientFileCID

CID for attached file if you want it inline. Multiple files are supported.

Example:

transientFile.1="t1.txt" transientFileContent.1="test 1" transientFileCID.1="t1.txt@xxx.yyy" transientFile.2="t3.txt" transientFileContent.2="test 3"

templateParams

Replace {varname} variables with values from this parameter.

Expected values are in the form of a JSON document

Example:

{  
   "varname":{  
      "value":"some value",
      "key":"context key"
   }
}

Each var name can either be provided with a value or a context key to retrieve the value from.

additionalHeader

Custom header to add to an email.

Command Example
!send-mail to="name@company.com" cc="test@company.com" bcc="admin@company.com" subject="Topic of the day" replyTo="replymail@company.com" attachIDs="111@02a9cf84-c76f-4b2e-8840-c6b2a85c53cf,129@02a9cf84-c86f-4b2e-8840-c6c2a89c53cf" attachNames="notcookie.png,cookie.jpg" attachCIDs="notcookie,mycookie" transientFile="friendly_note.txt" transientFileContent="this is some text" htmlBody="<html>
<body>
<p>HELLO</p>
<img src=\"cid:mycookie\"/>
</body>
</html>"

About CIDs

CIDs work by attaching the image to the email you are sending, and then using standard HTML image tags that reference that image to embed it in the email when the user opens it.

Example:
<html>
  <body>
    <img src="cid:radomimagecid"/>
  </body>
</html>

CID Limitations

CID is not supported on all email applications. It is supported mainly on Outlook.

On web applications, such as Gmail, adding CID duplicates the attachment: as an actual attachment and embedded in the text body.