Skip to main content
Version: 8 - Apfelstrudel

ConnectorTypeSMTP

class connector_types.connector_type_smtp.ConnectorTypeSMTP

Send an email using an SMTP server.

Input Schema

  • from_

    The sender email address.

    Type: anyOf

  • to

    Recipients.

    Type: anyOf

  • cc

    Type: anyOf

  • bcc

    Type: anyOf

  • subject

    Type: string

  • text

    The text will be the body of the email. You can supply it as

    text or html or both. If you supply both, the recipient can choose

    to see the email in either html or plain text.

    Type: anyOf

  • html

    HTML formatted body of the email. If only a HTML formatted body

    is supplied, Cloudomation will automatically generate a text version.

    Type: anyOf

  • login

    Username to log in to the SMTP server.

    Type: anyOf

  • password

    Type: anyOf

  • smtp_host

    Type: string

  • smtp_port

    Type: anyOf

  • use_tls

    Whether or not to use a Transport Security Layer (TLS) encrypted connection.

    Type: boolean

    Default: True

  • attachments

    A list of files to attach to the email.

    Can be a reference to a Cloudomation file by specifying cloudomation:<file-name>

    or an URL to an external file which will be fetched.

    Type: array

  • from

    DEPRECATED. Replaced by from_.

Output Schema

Constants

ssl_context_inputs = ['check_hostname', 'client_cert', 'client_key', 'server_ca']

Example

import flow_api

def handler(system: flow_api.System, this: flow_api.Execution, inputs: dict):
# create an SMTP connection and run it
this.connect(
connector_type='SMTP',
inputs={
'from_': 'Cloudomation <info@cloudomation.com>',
'to': 'info@cloudomation.com',
'subject': 'Cloudomation email',
# the text will be the email body. Alternatively you could add
# a html formatted body with the key 'html'.
'text': 'This email was sent with Cloudomation',
'login': 'cloudomation@cloudomation.com',
'password': '****',
'smtp_host': 'SMTP.example.com',
'smtp_port': 587,
'use_tls': True
}
)
# the SMTP connection does not produce any outputs
return this.success(message='all done')

Sending attachments is also possible with this connector type. Add a property 'attachments' to the inputs dict. There are two ways to specify attachments:

  • with cloudomation:filename where filename points to a file in the cloudomation workspace
  • with an URL where URL points to a http/https accessible file

The attachmentsproperty is of type list.