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.
Property | Description | Default | Type | Required |
---|---|---|---|---|
type | Stage class name | - | string | Yes |
enable | Enable stage for execution | true | boolean | No |
name | Name for this specific stage | string | No | |
save_to_intermediate | If true, the result of the stage will be stored in the intermediate instead of the final section | false | boolean | No |
data_preparation_stage_name | Indicates the name of the stage that contains and prepares the data to be sent via email. | - | string | Yes |
_send_mail = SendEmailStage( data_preparation_stage_name="prep_stage", enable=True, name='send_mail_stage', )
The data that will be used to send an email needs to be on the intermediate object and must have these properties:
Property | Description | Default | Type | Required |
---|---|---|---|---|
from_email | Email that will be used as a source of all the emails sent. | - | string | Yes |
to_email | List of all the email addresses that will be recipients of the emails sent. | - | list | Yes |
subject | Subject of the email sent. | string | String | |
data_url | (Optional) Comes from the default template. A value that will be replaced on the template. | - | string | No |
username | (Optional) Comes from the default template. A value that will be replaced on the template. | - | string | No |
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!