Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

catch all 规则没有获取邮件 #14

Closed
mainjaylai opened this issue Dec 26, 2024 · 8 comments
Closed

catch all 规则没有获取邮件 #14

mainjaylai opened this issue Dec 26, 2024 · 8 comments

Comments

@mainjaylai
Copy link

我已经在我的个人域名上部署好了 :https://mail.limingjie.us.kg 欢迎大家注册😀

但是我测试的时候发现了,catch all 并没有获取到邮件,随后我便在 cloudflare 中设置了自定义规则路由(如下图),发现这样才能捕获到。

Screenshot 2024-12-26 at 6 56 57 PM

捕获成功的样子⬇️

Screenshot 2024-12-26 at 6 56 05 PM

但是这样注册的每个邮箱都得添加规则,有点麻烦,不知道是不是我配置的原因还是 cloudflare 本身的原因,catch all 没有捕获到我新建的邮箱

@beilunyang
Copy link
Owner

email worker 有报错吗

@mainjaylai
Copy link
Author

@beilunyang 部署是没有任何问题的

Screenshot 2024-12-30 at 9 32 51 AM

然后我看 cloudflare 里面的 email-receiver-worker 里面访问是显示这样子的

Screenshot 2024-12-30 at 9 36 07 AM

@beilunyang
Copy link
Owner

@beilunyang 部署是没有任何问题的

Screenshot 2024-12-30 at 9 32 51 AM 然后我看 cloudflare 里面的 email-receiver-worker 里面访问是显示这样子的 Screenshot 2024-12-30 at 9 36 07 AM

你去 dashboard 启用下 email-receiver-worker 的日志功能, 然后看看有没有报错

@mainjaylai
Copy link
Author

@beilunyang 没有报错,不过还是和之前一样的问题

Screenshot 2024-12-31 at 9 41 46 AM

就是只有我指定特定的邮箱发送到 email-receiver-worker 才能接收到(比如我特定指定了 [email protected]),但是比如我没有指定的邮箱(比如 [email protected]),然后 email-receiver-worker 并没有接收到,所以我怀疑是 catch-all 规则的问题

Screenshot 2024-12-31 at 9 45 12 AM

@beilunyang
Copy link
Owner

beilunyang commented Jan 6, 2025

https://community.cloudflare.com/t/the-status-of-the-email-routing-rules-cannot-be-enabled/681051
你的账户下状态一列一直在loading,正常应该是显示”活动“, 你的账户可能触发了 Cloudflare 的 Bug

image

@beilunyang
Copy link
Owner

问题描述

我新建了一个cloudflare账户,复现了这个问题,默认 Catch-all 规则是禁用的,需要手动点击状态一列的开关,来启用。但由于cloudflare 的 bug,状态一列一直显示 loading, 无法显示启用开关,导致无法启用 Catch-all 规则。

解决方法

Cloudflare 有 提供 API , 可以不通过 dashboard 界面来启用 Catch-all 规则。API 文档:
https://developers.cloudflare.com/api/node/resources/email_routing/subresources/rules/subresources/catch_alls/methods/update/

我写了个脚本,填写参数,运行即可

import Cloudflare from 'cloudflare';

const client = new Cloudflare({
  apiToken: '<具有Email Routing Rules 编辑权限的 API_TOKEN>',
});

const emailRoutingRule = await client.emailRouting.rules.catchAlls.update('<你的ZONE_ID>', {
  actions: [{ type: 'worker', value: ['email-receiver-worker'] }],
  matchers: [{  type: 'all'  }],
  enabled: true,
  name: 'Catch-all rule',
});

console.log(emailRoutingRule);

@mainjaylai
Copy link
Author

成功了!!大佬太强了👍 感谢大佬 @beilunyang

@beilunyang beilunyang pinned this issue Jan 10, 2025
@xiciya201477
Copy link

大佬,大佬,这个参数怎么写,我有点理解不了,然后这个在哪运行,我不清楚,我是小白@beilunyang

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

3 participants