【问题标题】:Send function output as an email in IBM cloud functions在 IBM 云函数中将函数输出作为电子邮件发送
【发布时间】:2019-01-14 20:31:27
【问题描述】:

我有以下代码,它给了我一个 csv 文件:

def main(args):
    data = get_data()
    csv_output = get_csv_file_data(data)
    return {'body': csv_output.getvalue(),
            'headers': {'Content-Type': 'text/csv',
            'Content-Disposition': 'attachment;filename=myfilename.csv'}}

IBM 云中有没有一种方法可以在函数内将此 CSV 文件作为电子邮件发送?

【问题讨论】:

    标签: ibm-cloud ibm-cloud-functions


    【解决方案1】:

    IBM Cloud 不提供电子邮件服务作为其平台服务 (IBM Cloud cata) 的一部分,但您可以使用 SendGrid,直接SendGrid 或通过classic infrastructure services on IBM Cloud

    此代码示例 OpenWhisk Contact 使用 SendGrid 通过 IBM Cloud Functions 发送电子邮件。

    【讨论】:

    • 我们可以使用任何电子邮件提供商吗?就像带有 IBM Functions 的 Amazon SES?
    • 您可以使用任何电子邮件提供商。该函数/操作将连接到 SMTP 服务器并发送电子邮件。
    猜你喜欢
    • 2017-01-05
    • 2018-07-14
    • 1970-01-01
    • 1970-01-01
    • 1970-01-01
    • 1970-01-01
    • 1970-01-01
    • 2022-01-17
    • 1970-01-01
    相关资源
    最近更新 更多