每当用户从 firebase 后端提交表单时,尝试接收用户填写的所有信息的邮件

问题描述 投票:0回答:0

`每当用户在我的网站上填写并提交表格时,我都想收到一封邮件。为此,我在后端使用 aws-sdk 和 nodemailer 制作了一个邮件程序

由于 bug,我不想再使用 aws-sdk。所以我决定改用@aws-sdk/client-ses

但是我在实施中遇到了一些问题。我已经完成了实施,但是我在提交后面的咳嗽时遇到错误。

之前

import aws from 'aws-sdk';
import  nodemailer  from 'nodemailer';

 toMail: string;
 fromMail: string;
 credential: any;


export class{
 toMail: string;
 fromMail: string;
 credential: any;

constructor() {
this.toMail = my mailid;
this.fromMail = noreply mail id

this.credential= new aws.SES({
//some code
        accessKey:*****************,
        secretKey: ****************,
        region: **************,
    });}


async sendMail(details of receiver and sender)
  ) {
    let transporter = nodemailer.createTransport({
     SES: this.credential,
    });
    return transporter.sendMail(info);
  }
}

在实施 @aws-sdk/client-ses 代替 aws-sdk 之后

import aws, { SendRawEmailCommand } from '@aws-sdk/client-ses';
import nodemailer from 'nodemailer';

export class something{
 toMail: string;
 fromMail: string;
 credential: any;

constructor() {
this.toMail = my mailid;
this.fromMail = noreply mail id

this.credential= new aws.SES({
//some code
      credentials: {
        accessKey:*****************,
        secretKey: ****************,
      },
        region: **************,
    });}


async sendMail(details of receiver and sender)
  ) {
    let transporter = nodemailer.createTransport({
    

SES: { ...this.credential, aws: { SendRawEmailCommand } },
    });
    return transporter.sendMail(info);
  }
}

提交按钮错误=>>>>>> 糟糕! 你的有问题 请求让我们再试一次

**``` 在网络选项卡中出现此错误 >>>> 无法读取未定义的属性(读取“SES”)


**no error in terminal **

`
node.js amazon-web-services amazon-ses mailer
© www.soinside.com 2019 - 2024. All rights reserved.