无法使用Cloud Functions for Firebase发送邮件 [英] Can't send mail with Cloud Functions for Firebase

查看:148
本文介绍了无法使用Cloud Functions for Firebase发送邮件的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

我正在尝试使用 sendmail 包从Cloud Function发送电子邮件. 当我在本地托管发送功能"时,它可以工作.而且我可以毫无问题地将功能部署到我的Firebase项目中.

I'm trying to send an email from a Cloud Function using the sendmail package. It works when I host my "send function" locally. And I can deploy the function without problems to my Firebase project.

在Firebase的日志中,我可以看到以下消息:

In the log at Firebase I can see this message:

Error: queryMx ESERVFAIL hotmail.com
at errnoException (dns.js:28:10)
at QueryReqWrap.onresolve [as oncomplete] (dns.js:219:19)

我不熟悉从服务器或Cloud Functions for Firebase发送电子邮件.我的问题是为什么我会收到此错误以及如何使其正常工作?

I'm neither familiar with sending emails from servers or Cloud Functions for Firebase. My question is why I got this error and how I can make it work?

这是我的摘录:

sendmail({
        from: body.name + ' ' + '<' + body.email + '>',
        to: 'soerensmed@hotmail.com',
        subject: 'Henvendelse via kontaktformular',
        html: html,
    }, function (err, reply) {
        if (err) {
            console.log(err && err.stack);
            response.status(500).end()
        }
        else {
            console.log(reply)
            response.status(200).end()
        }
    });

我正在开发一个网站,人们可以通过联系表格与我联系.我们的目标是接收带有消息的电子邮件...如果无法采用这种方法,我欢迎您提出有关如何使用Angular和Firebase设置此联系人电子邮件的建议.

I'm developing a website where people can contact me through a contact form. The goal is to receive an email with the message... If this approach isn't possible I'm open for suggestions on how I can set this contact-email-thing up using Angular and Firebase.

推荐答案

它不能与带有免费Spark帐户的云功能一起使用.您应该升级,因为它在网络框中的定价部分中明确定义. https://firebase.google.com/pricing/

It will not work with cloud function with free spark account. You should upgrade as it is clearly defined in pricing section in network box. https://firebase.google.com/pricing/

这篇关于无法使用Cloud Functions for Firebase发送邮件的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

查看全文
登录 关闭
扫码关注1秒登录
发送“验证码”获取 | 15天全站免登陆