Email V2

Know the componente and how to use it.

Micaella Mazoni avatar
Written by Micaella Mazoni
Updated over a week ago

IMPORTANT: This documentation has been discontinued. Read the updated Email V2 documentation on our new documentation portal.

Email V2 allows you to send simple emails, in HTML format or even with attachments.

Take a look at the configuration parameters of the component:

  • Account: necessary for the component to make the authentication of the email server to be used in the dispatch, in case this email service is requested in the authentication. A BASIC account type must be selected.

  • SMTP Host: SMTP host of the email server. Eg.: (GMail: smtp.gmail.com)

  • SMTP Port: SMTP port of the email server. Port 587 is generally used, but it can vary according to the email server.

  • From: email sender.

  • To: email recipient. If there're multiple recipients, they must be separated by comma. Eg: a@a.com,b@b.com,....

  • CC: recipients who will receive a copy of the email. If there're multiple recipients, they must be separated by comma. Eg: a@a.com,b@b.com,....

  • BCC: recipients who will receive a hidden copy of the email. If there're multiple recipients, they must be separated by comma. Eg: a@a.com,b@b.com,....

  • Content: email body. It accepts the use of Freemarker templates to generate dynamic HTML.

  • Charset: charset to be used in the email body dispatch.

  • Subject: subject of the email.

  • Authenticated: if the option is enabled, it's mandatory to provide an account with email and password to be used for authentication. If the dispatches don't need authentication, the option must remain disabled.

  • Is Over SSL: if the option is enabled, the dispatch is made via SSL.

  • SSL Port: if the option Is Over SSL is enabled, then it's mandatory to inform which port will be used to traffic the message via SSL.

  • Is Over TLS: if the option is enabled, the dispatch is made via TLS.

  • Force TLSv1.2: it sets the use of the protocol TLS V1.2 as mandatory for connections with email servers.

  • Use Attachment As Raw: if the option is enabled, the form to add attachments will be hidden and the dispatch in RAW mode may be used, through which you inform the attachments array. But if the option is disabled, the form approach will be used to specify the attachments.

  • Attachments: message attachments. The specification is made via form.

IMPORTANT: to add imagens inside the email body, the "cid:" prefix must be informed before the image name. Eg.: <img src"cid: image.png" />

  • Fail On Error: if the option is enabled, the execution of the pipeline with error will be interrupted; otherwise, the pipeline execution proceeds, but the result will show a false value for the “success” property.

Messages flow

Input

This component doesn't expect any specific input message, only if an expression in Double Braces is informed in some of its fields.

Output

When executing an Email V2 component, the following JSON structure will be generated:

{
"from": "a@a.com",
"to": "a@a.com,a@a.com.br",
"cc":"a@a.com,a@a.com.br",
"bcc": "a@a.com,a@a.com.br",
"subject": "Subject",
"content": "<html>Test Email!</html>",
"charset": "UTF-8",
"success": true,
"attachments": [{
"type": "ATTACHMENT",
"attachment": "attachment.extension"
}]
}

  • from: sender

  • to: recipients

  • cc: recipients in copy

  • bcc: recipients in hidden copy

  • subject: subject

  • content: message body. If the message body exceeds 256 characters, the result will be truncated.

  • charset: charset

  • success: if the message is well succeed

  • attachments: array with the sent attachments

IMPORTANT: the files manipulation inside a pipeline occurs in a protected way. The files can be accessed in a temporary directory that only the pipeline under deployment has access to.

To better understand the messages flow in the Platform, click here and read our article.

Email V2 in Action

See below how the component responds to a determined situation and its respective configuration.

Sending a text file (xpto.txt) as attachment in RAW mode and the email body having images as well

<!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.0 Transitional//EN" "http://www.w3.org/TR/xhtml1/DTD/xhtml1-transitional.dtd">
<html xmlns="http://www.w3.org/1999/xhtml">
<head>
<meta http-equiv="Content-Type" content="text/html; charset=UTF-8" />
<title>Demystifying Email Design</title>
<meta name="viewport" content="width=device-width, initial-scale=1.0"/>
</head>
<body>
<img src="cid:myImage.png" />
</body>
</html>

  • Authenticated: enabled

  • Is Over TLS: enabled

  • Attachment As Raw: enabled

  • Attachments:

[
{"type": "INLINE", "attachment": "myImage.png" },
{"type": "ATTACHMENT", "attachment": "xpto.txt" }
]

The result will be:

{
"from": "email@gmail.com",
"to": "some_other_email@gmail.com,second_email@gmail.com",
"cc":"",
"bcc": "",
"subject": "Hello",
"content": "<!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.0 Transitional//EN" "http://www.w3.org/TR/xhtml1/DTD/xhtml1-transitional.dtd"><html xmlns="http://www.w3.org/1999/xhtml"> <head> <meta http-equiv ...TRUNCATED",
"charset": "UTF-8",
"success": true,
"attachments": [
{"type": "INLINE", "attachment": "myImage.png" },
{"type": "ATTACHMENT", "attachment": "xpto.txt" }
]
}

See how to pass values in a dynamic way using the connector:

Notice that the connector allows Double Braces

<!DOCTYPE html>
<html>
<head>
</head>
<body>

Good afternoon, <br/>
Below is the invoice <a href='${NF}'>(Click here)</a> referring to the monthly license fee for the platform – due for <b> ${M_VENC}</b>. <br/>
Payment will be via <b>bank transfer</b> - given in the body of the invoice. <br/><br/>


Please, confirm the receipt. <br/>
Any questions, we are available. <br/><br/>
<br/>
<br/>
Att.,
Customer relationship
</body>
</html>

JSON Data

{
"remetente": "digibee@gmail.com",
"destinatario" : "digi@gmail.com",
"destinatario_cc" : "digi1@gmail.com",
"destinatario_bcc" : "digi2@gmail.com",
"port" : "587",
"host": "smtp.gmail.com",
"NF": "98787979789",
"M_VENC" : "13/01/2023"
}

Technology

We use Freemarker to make our conversions and transformations in the email body template. To know more about Freemaker and how to use it, click here.

Did this answer your question?