Облачные функции Firebase отправляют электронную почту, но не доставляются на адреса электронной почты - PullRequest
0 голосов
/ 04 апреля 2020

Я пытался отправить письмо с помощью функции 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 было: Биллинг аккаунт не настроен. Внешняя сеть недоступна, и квоты строго ограничены. Настройте учетную запись для снятия этих ограничений ..., которые я создал. Заранее спасибо

...