学习 / 邮件指南 / 定时发送邮件

定时发送邮件

2:28 分钟

有些邮件不应在代码执行的瞬间就发出去——摘要邮件应该在早上九点发送。在 Bird 中,延迟发送只需在普通发送请求中加一个字段:scheduled_at。我们设定一个定时发送,回读它,在日志中找到它并看到实时倒计时和取消按钮,然后看着它准时送达。

内容概览

  • 在仪表板或 API 中选择发送时间
  • 按收件人所在时区定时发送
  • 取消或编辑已计划的发送
Transcript

Auto-generated from the video.

Hey there. Welcome to another video. Today we're going to be looking at scheduling an email. Um, there might be specific events where sending an email is required, but not exactly at the moment that an event happens. Let's say the moment a customer signs up to your account, you want to send a welcome email, but you don't want to send it right away cuz you want them to continue the action on your website. So you want to trigger it, let's say 10, 20, 30 minutes into the future. Now, this is where scheduling sends uh come into play. We basically take all of the heavy lifting off uh using the calculations. You send your email as you normally would. The only difference is that you're going to be sending a additional scheduled at parameter with your um with your send, enabling us to actually take care of that schedule.

So here we've got the documentation. We can just have a quick look. As you can see that the only big difference here is that we have a scheduled at included, which we then use to actually take uh the processing on our end. Um, I have a quick send setup.

So we're actually just triggering an email as we normally would. I have the body stored on a local file, and we can see that the email is just accepted as normal. And besides this, everything looks the way that it has been looking. Now, the biggest difference is if we go into the dashboard and we go to our email logs, is that we can actually see that the email is now in a scheduled state. So it's treated as an actual email, it just isn't actually sent yet.

But the moment that your email is um supposed to go out, we will just proceed to actually going into that next stage. So your email will stay on the status of accepted, and the process will happen the moment that we actually send it.

Now, what happens if you actually want to cancel a specific send? Well, there's two ways, you might have already seen it. Within the dashboard itself, you have the option to cancel a send, but we can also do this via the API. Now, we can also cancel it via API.

So I've got Boom, right there. Simple CLI email cancel with the email ID from our previous send. And we say we want to cancel it. Yes, and the ID is then Okay. Happy path. Um cancelled from there onwards. It's a simple one. It's a short one.

Cancelling your emails available now. Happy sending.

从一个渠道开始。
准备好后,再添加其他渠道。

测试 API 密钥即刻可用。添加支付方式并验证发送者身份后,即可解锁生产环境。

正在使用 Claude Code、Cursor 或 Codex?复制一条设置提示,您的智能代理即可自动安装 Bird CLI 和相关技能。选择您的工具:

Cursor