• 请不要在回答技术问题时复制粘贴 AI 生成的内容
yasea
V2EX  ›  程序员

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

  •  
  •   yasea · Feb 15, 2022 · 2340 views
    This topic created in 1574 days ago, the information mentioned may be changed or developed.

    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 replies    2023-11-20 03:39:34 +08:00
    Kasumi20
        1
    Kasumi20  
       Feb 15, 2022
    Uncaught ReferenceError: AWS is not defined
    yasea
        2
    yasea  
    OP
       Feb 15, 2022
    @Kasumi20 需要引用 amazon 的 JS SDK 文件, 替换 credentials 信息(换成自己的 amazon 帐号内容)
    Michelangelono
        3
    Michelangelono  
       Feb 16, 2022 via Android
    免费多大额度?
    yasea
        4
    yasea  
    OP
       Feb 16, 2022
    @Michelangelono
    Amazon EC2 中的应用程序发送电子邮件, 每月前 62000 封电子邮件免费,之后每发送 1000 封电子邮件 0.10 USD
    damngoto
        5
    damngoto  
       Feb 16, 2022
    不如发个链接?
    yasea
        6
    yasea  
    OP
       Feb 16, 2022
    asdfzxh
        7
    asdfzxh  
       Nov 20, 2023
    no such thing as cxy, not defined by some tech or whatever
    About   ·   Help   ·   Advertise   ·   Blog   ·   API   ·   FAQ   ·   Solana   ·   5218 Online   Highest 6679   ·     Select Language
    创意工作者们的社区
    World is powered by solitude
    VERSION: 3.9.8.5 · 49ms · UTC 09:33 · PVG 17:33 · LAX 02:33 · JFK 05:33
    ♥ Do have faith in what you're doing.