V2EX = way to explore
V2EX 是一个关于分享和探索的地方
现在注册
已注册用户请  登录
yasea
V2EX  ›  程序员

分享一个 JAVASCRIPT(AMAZON SES SDK)发送邮件的方法, 便宜好用!

  •  
  •   yasea · 2022-02-15 14:13:06 +08:00 · 1363 次点击
    这是一个创建于 802 天前的主题,其中的信息可能已经有所发展或是发生改变。

    var credentials = { accessKeyId: "AMAZON accessKeyId", secretAccessKey: "secretAccessKey accessKey" }; AWS.config.update(credentials); AWS.config.region = 'ap-southeast-1';
    var sesv2 = new AWS.SESV2(); var params = { Content: {
    Simple: { Body: { Html: { Data: '邮件内容', Charset: 'UTF-8' } }, Subject: {
    Data: '邮件主题',
    Charset: 'UTF-8' } } },
    Destination: { ToAddresses: ['xxxx 收件人 [email protected]'] }, FromEmailAddress: '发件人 xxxx', FromEmailAddressIdentityArn: '发件人 ARN',
    }; sesv2.sendEmail(params, function(err, data) { if (err) console.log(err, err.stack); // an error occurred else console.log(data); // successful response });

    7 条回复    2023-11-20 03:39:34 +08:00
    Kasumi20
        1
    Kasumi20  
       2022-02-15 16:04:15 +08:00
    Uncaught ReferenceError: AWS is not defined
    yasea
        2
    yasea  
    OP
       2022-02-15 16:11:47 +08:00
    @Kasumi20 需要引用 amazon 的 JS SDK 文件, 替换 credentials 信息(换成自己的 amazon 帐号内容)
    Michelangelono
        3
    Michelangelono  
       2022-02-16 08:35:19 +08:00 via Android
    免费多大额度?
    yasea
        4
    yasea  
    OP
       2022-02-16 09:10:00 +08:00
    @Michelangelono
    Amazon EC2 中的应用程序发送电子邮件, 每月前 62000 封电子邮件免费,之后每发送 1000 封电子邮件 0.10 USD
    damngoto
        5
    damngoto  
       2022-02-16 10:10:16 +08:00
    不如发个链接?
    yasea
        6
    yasea  
    OP
       2022-02-16 10:14:53 +08:00
    asdfzxh
        7
    asdfzxh  
       160 天前
    no such thing as cxy, not defined by some tech or whatever
    关于   ·   帮助文档   ·   博客   ·   API   ·   FAQ   ·   我们的愿景   ·   实用小工具   ·   921 人在线   最高记录 6543   ·     Select Language
    创意工作者们的社区
    World is powered by solitude
    VERSION: 3.9.8.5 · 122ms · UTC 20:03 · PVG 04:03 · LAX 13:03 · JFK 16:03
    Developed with CodeLauncher
    ♥ Do have faith in what you're doing.