【问题标题】:aws ses automation script : Error parsing parameter '--destination': Expected: '=', received: '@' for input:aws ses 自动化脚本:解析参数“--destination”时出错:预期:“=”,接收到:“@”用于输入:
【发布时间】:2020-12-30 09:00:19
【问题描述】:

我已经读了一段时间了。通常我自己处理一些事情,但今天我需要一个提示。

因此,我的任务是在我的新工作(10 万观众)中以最少的预算和很短的通知时间(明天)运行电子邮件活动。我倾向于 AWS(亚马逊网络服务),因为亚马逊 SES(简单电子邮件服务)非常便宜,而且您只需支付您使用的费用。

尝试在命令行上使用 AWS 开发工具包。我制作了一个小脚本来逐行读取地址文件(.txt)并执行发送邮件命令

#! /bin/bash

file='./test-list.txt'
from='sender@domain.com'

for line in $(<$file)
do
    #send mail
    aws ses send-templated-email --source=$from --destination=$line --template 'test' --template-data ""
done

脚本返回错误信息:

Error parsing parameter '--destination': Expected: '=', received: '@' for input:
To:recipient@domain.com

现在我不是 bash 之王,但我尝试了不同的参数公式,但没有什么能让我摆脱错误。 输入文件中的每一行都是正确的电子邮件地址,这看起来像是解析问题,但我不明白。

有什么想法吗?这会很有帮助:)

【问题讨论】:

    标签: amazon-web-services amazon-simple-email-service


    【解决方案1】:

    您需要对来自https://docs.aws.amazon.com/cli/latest/reference/ses/send-templated-email.html#options的目的地使用正确的格式

    使用send-email的示例:

    aws ses send-email --from "example.com" --destination "ToAddresses=${line}" --text "hello world!" --subject "test"
    

    像给定的例子:

    aws ses send-templated-email --source $from --destination "ToAddresses=${line}" --template "test" --template-data ""
    

    【讨论】:

    • 这确实有效!谢谢 !我可能误读了文档并写了“To=”而不是“ToAddresses=”。我的 --template-data 参数也是空的,但因为它必须是一个有效的 json 对象,所以我编辑了 "{}" 和 Voilà !
    猜你喜欢
    • 2019-08-06
    • 1970-01-01
    • 1970-01-01
    • 2020-01-05
    • 1970-01-01
    • 2020-08-25
    • 1970-01-01
    • 1970-01-01
    • 2019-03-23
    相关资源
    最近更新 更多