Close
    logoCloudomation Docs

    TaskSMTP

    class tasks.task_smtp.TaskSMTP

    Send an email using an SMTP server.

    Inputs

    NameTypeDefaultDescription
    attachmentsList[]
    bcclist[]
    cclist[]
    fromStringNonedeprecated. replaced by from_
    from_StringNonethe sender email address
    htmlStringNoneHTML formatted body of the email. If only a HTML formatted body is supplied, Cloudomation will automatically generate a text version.
    loginStringNone
    passwordStringNone
    smtp_hostString
    smtp_portNumber25
    subjectString
    textStringNoneThe 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.
    tolist[]
    use_tlsBooleanTrueWhether or not to use a Transport Security Layer (TLS) encrypted connection

    Outputs

    NameTypeDefaultDescription
    execution_idintThe ID of the task execution
    messagestrThe ended message for the task. If the task ended with an error, the message will contain information about what went wrong
    statusstrThe ended status for the task. Either "success" or "error".

    Constants

    input_list = ['attachments', 'bcc', 'cc', 'from', 'from_', 'html', 'login', 'password', 'smtp_host', 'smtp_port', 'subject', 'text', 'to', 'use_tls']output_list = []version = 1

    Methods

    run ()

    Example

    import flow_api
    def handler(system: flow_api.System, this: flow_api.Execution):
    # create an SMTP task and run it
    this.task(
    '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
    }
    )
    # there are no outputs for the SMTP task
    return this.success(message='all done')
    Previous
    TaskSMB
    Next
    TaskSOAP