Firebase Cloud Functions发送电子邮件但未发送到电子邮件地址

时间:2020-04-04 17:42:12

标签: firebase vue.js google-cloud-functions nodemailer

我正尝试使用Firebase Cloud功能发送电子邮件,它已于昨天发送和发送,突然间,它就停止了发送。

const functions = require('firebase-functions');
const admin = require('firebase-admin');
const nodemailer = require('nodemailer');
const cors = require('cors')({
  origin: true
})

admin.initializeApp();


let transporter = nodemailer.createTransport({
  service: 'gmail',
  auth: {
    user: 'my@gmail.com',
    pass: 'password'
  }
});

exports.sendEmail = functions.https.onCall(async (data, context) => {

  try {
    const mailOptions = {
      from: `Message from Antrum Engineering`,
      to: "my@gmail.com, myfrind@gmail.com",
      subject: "AET Website Message ????", // Subject line
      attachments: [{
        filename: 'image.png',
        path: '../src/assets/mail.png',
        cid: 'unique@nodemailer.com'
      }],
      html: `
            <div
              style="padding: 20px; 
              font-family:'Montserrat';
              width: 35%; 
              margin: 0 auto; 
              border: 1px solid rgba(0, 0, 0, 0.125); 
              border-radius: 5px;
              text-align: center;"
            >
            <div style="padding: 20px; margin-bottom: 10px;">
              <img width="200" 
                src="cid:unique@nodemailer.com" 
                alt="mail picture" 
              />
            </div>
            <h2 style="font-weight: 400; margin-bottom: 16px">Contact Details</h2>
            <div style="font-size: 13px">
              <p style="font-weight: 400">Name: ${data.name}</p>
              <p style="font-weight: 400">Email: ${data.email}</p>
            </div>
            <hr style="border: 0.3px solid rgba(0, 0, 0, 0.125);" />
            <h2 style="font-weight: 400">Message</h2>
            <p style="font-size: 13px !important; font-weight: 400">${data.message}</p>
          </div>
    `
    };

    await transporter.sendMail(mailOptions);

    return null;

  } catch (error) {
    return error;
  }

})

控制台中没有错误,我在Firebase日志上的唯一记录是:未配置结算帐户。无法访问外部网络,并且配额受到严格限制。配置结算帐户以删除我创建的这些限制...。预先感谢

0 个答案:

没有答案