带Firebase Extension触发电子邮件的电子邮件发送到垃圾邮件

发布于 2025-02-08 23:55:52 字数 1900 浏览 0 评论 0原文

我在网页(使用Flutter Web制造)上配置了一个联系表格,以使用Firebase Extension Trigger电子邮件自动发送电子邮件。但是,它们直接进入垃圾邮件文件夹。我一直在阅读有关电子邮件转到垃圾邮件的原因,但我不知道我是否有这些。我认为身份验证(如所说这里)不应该是一个问题,因为来自电子邮件和登录的帐户是相同的。

这是扩展名的配置:

这是发送电子邮件的示例:

这是将文档添加到Firebase集合中的代码:

Future<void> _submitForm() async {
    final isValid = _key.currentState?.validate();

    if (isValid != null && isValid) {
      _key.currentState?.save();
      String message;

      try {
        final collection = FirebaseFirestore.instance.collection("mail");
        await collection.doc().set({
          "timestamp": FieldValue.serverTimestamp(),
          "to": ["Name LastName <[email protected]>"],
          "message": {
            "subject": _subject,
            "text": "Name: ${_name}\nEmail: ${_email}"
                "\nPhone: ${_phone}\n\n${_message}"
          }
        });

        _key.currentState?.reset();

        message = "Your message has been sent successfully. We will get in "
            "contact with you.";
      } catch (_) {
        message = "Your message could not be sent. Please try again later.";
      }

      ScaffoldMessenger.of(context)
          .showSnackBar(SnackBar(content: Text(message)));
    }
  }

我该如何解决此问题? 提前致谢。

I have a contact form configured on my webpage (made with Flutter web) to send emails automatically with Firebase extension Trigger Email. However, they go directly to the spam folder. I have been reading about the causes why emails go to spam and I don't know if I have any of those. I think authentication (as said here) should not be a problem since the FROM email and the account logged in are the same.

This is the configuration of the extension:
enter image description here

And this is an example of an email sent:
enter image description here

This is the code to add the document to the firebase collection:

Future<void> _submitForm() async {
    final isValid = _key.currentState?.validate();

    if (isValid != null && isValid) {
      _key.currentState?.save();
      String message;

      try {
        final collection = FirebaseFirestore.instance.collection("mail");
        await collection.doc().set({
          "timestamp": FieldValue.serverTimestamp(),
          "to": ["Name LastName <[email protected]>"],
          "message": {
            "subject": _subject,
            "text": "Name: ${_name}\nEmail: ${_email}"
                "\nPhone: ${_phone}\n\n${_message}"
          }
        });

        _key.currentState?.reset();

        message = "Your message has been sent successfully. We will get in "
            "contact with you.";
      } catch (_) {
        message = "Your message could not be sent. Please try again later.";
      }

      ScaffoldMessenger.of(context)
          .showSnackBar(SnackBar(content: Text(message)));
    }
  }

Any idea how could I fix this?
Thanks in advance.

如果你对这篇内容有疑问,欢迎到本站社区发帖提问 参与讨论,获取更多帮助,或者扫码二维码加入 Web 技术交流群。

扫码二维码加入Web技术交流群

发布评论

需要 登录 才能够评论, 你可以免费 注册 一个本站的账号。
列表为空,暂无数据
我们使用 Cookies 和其他技术来定制您的体验包括您的登录状态等。通过阅读我们的 隐私政策 了解更多相关信息。 单击 接受 或继续使用网站,即表示您同意使用 Cookies 和您的相关数据。
原文