The Send Email stage is useful when you want to send emails using the GAIA API. By adding an email account or an SMTP server, you can send emails to a single recipient or a list. The stage use a set of templates for the email to be sent and you can add your own template to customize your emails sent.


The data that will be used to create the email body and indicate the list of recipients needs to be added to the intermediate object of a pipeline.

Properties

PropertyDescriptionDefaultTypeRequired
typeStage class name-stringYes
enableEnable stage for executiontruebooleanNo
nameName for this specific stagestringNo
save_to_intermediateIf true, the result of the stage will be stored in the intermediate instead of the final sectionfalsebooleanNo
data_preparation_stage_nameIndicates the name of the stage that contains and prepares the data to be sent via email.-stringYes

Example Configuration

_send_mail = SendEmailStage(
    data_preparation_stage_name="prep_stage",
    enable=True,
    name='send_mail_stage',
)


Data Preparation Needed for sending emails


The data that will be used to send an email needs to be on the intermediate object and must have these properties:


PropertyDescriptionDefaultTypeRequired
from_emailEmail that will be used as a source of all the emails sent.-stringYes
to_emailList of all the email addresses that will be recipients of the emails sent.-listYes
subjectSubject of the email sent.stringString
data_url(Optional) Comes from the default template. A value that will be replaced on the template.-stringNo
username(Optional) Comes from the default template. A value that will be replaced on the template.-stringNo



Example of Data needed to send emails (Intermediate object)

data={
  "from_email": "[email protected]",
  "to_email": ["[email protected]", "[email protected]"],
  "subject": "This is a test",
  "data_url": "http://example.com/",
  "username": "This is an example"
}

IMPORTANT!

If you plan to use gmail as the email sender you need to follow these steps first!




  • No labels