Working with Email
You need to configure Corteza with your SMTP provider to send email messages. |
Sending emails directly
Use the email function step to immediately send an email message.
If you call the email function without specifying the from
argument, the SMTP_FROM
.env
variable is used.
The source code for the workflow can be found here.
Cc: cc@test.tld
Content-Type: multipart/alternative; boundary=4305315520b0c6018a31f71ea361d14aba596d49cb6041dcf323dbe83440
Date: Sun, 29 Aug 2021 11:16:06 +0200
From: from@test.tld
MIME-Version: 1.0
Message-ID: omDfvBmYViB5Jo2Y-MESerSmRIi0Z0a7wt9z_LaX_wk=@mailhog.example
Received: from localhost by mailhog.example (MailHog)
id omDfvBmYViB5Jo2Y-MESerSmRIi0Z0a7wt9z_LaX_wk=@mailhog.example; Sun, 29 Aug 2021 09:16:06 +0000
ReplyTo: replyto@test.tld
Return-Path: <from@test.tld>
Subject: Hello, world!
To: to@test.tld
--4305315520b0c6018a31f71ea361d14aba596d49cb6041dcf323dbe83440
Content-Transfer-Encoding: quoted-printable
Content-Type: text/plain; charset=UTF-8
Hello, world!
--4305315520b0c6018a31f71ea361d14aba596d49cb6041dcf323dbe83440
Content-Transfer-Encoding: quoted-printable
Content-Type: text/html; charset=UTF-8
<br>Hello, world!</br>
--4305315520b0c6018a31f71ea361d14aba596d49cb6041dcf323dbe83440--
Email builder
The email builder function step allows you to assemble an email message without sending it.
The email builder allows you to further enrich the email message with additional parameters such as other recipients.
The source code for the workflow can be found here.
Content-Type: multipart/alternative; boundary=122730f4fe6b767154618c2972886463a224ea74df15f5c96662da9e6a70
Date: Sun, 29 Aug 2021 11:51:33 +0200
From: Corteza <info@local.cortezaproject.org>
MIME-Version: 1.0
Message-ID: m7mFhiH28t1F8HCaTB7g3CKMKH4qE_N4J6uqLDktytE=@mailhog.example
Received: from localhost by mailhog.example (MailHog)
id m7mFhiH28t1F8HCaTB7g3CKMKH4qE_N4J6uqLDktytE=@mailhog.example; Sun, 29 Aug 2021 09:51:33 +0000
Return-Path: <info@local.cortezaproject.org>
Subject: Hello, world!
To: "testko" <testko@test.tld>, "testko2" <testko2@test.tld>
--122730f4fe6b767154618c2972886463a224ea74df15f5c96662da9e6a70
Content-Transfer-Encoding: quoted-printable
Content-Type: text/plain; charset=UTF-8
Hello, world!
--122730f4fe6b767154618c2972886463a224ea74df15f5c96662da9e6a70
Content-Transfer-Encoding: quoted-printable
Content-Type: text/html; charset=UTF-8
<b>Hello, world!</b>
--122730f4fe6b767154618c2972886463a224ea74df15f5c96662da9e6a70--
Email builder methods
The function returns an assembled email message, which you can later extend with the following functions. |
|
The function sends the given email message. |
|
The function sets the email subject. |
|
The function overwrites the headers originally defined by the email builder function. |
|
The function overwrites the header originally defined by the email builder function. |
|
The function overwrites the email addresses of the specified recipient type with the provided address. The available recipient types:
|
|
The function appends the provided email address to the list of specified recipient type list. The available recipient types:
|
|
The function adds an attachment to the email message. |
|
The function embeds an attachment to the email message. |
Email Formats
test@mail.tld name
-
A name optionally follows the email address. See the examples provided below:
-
test@mail.tld Jane Doe
-
test@mail.tld Jane
-
test@mail.tld
-
{"test@mail.tld": "name"}
-
A
KV
where the key is an email and the value is the name. Examples:-
{"test@mail.tld": "Jane Doe"}
-
{"test@mail.tld": "Jane Doe", "test2@mail.tld": "John"}
-
Send attachments
Refer to the example workflow for sending attachments.