简体   繁体   English

如何提高 email 的鲁棒性? [邮筒,laravel]

[英]How to improve email robustness? [mailgun, laravel]

I planned to improve email robustness using below way.我计划使用以下方式提高 email 的鲁棒性。 I am using laravel and mailgun .我正在使用laravelmailgun If any bounces email is in the mailgun then i want to send that to someone related to the email(not to that previous receiver and it related with previous sender or someone) so that i plan to use Task scheduler and schedule every hour this process.如果有任何反弹 emailmailgun中,那么我想将其发送给与电子邮件相关的人(而不是发送给之前的接收者,并且它与之前的发件人或某人有关),以便我计划使用任务调度程序并每小时安排这个过程。 After that email send successfully i want to remove that email from mailgun .之后 email 发送成功,我想从 mailgun 中删除mailgun

I actually want to know how to implement get bounces email from mailgun and if send successfully using Task scheduler i want to remove that email from mailgun .我实际上想知道如何实现从mailgun获取退回 email ,如果使用任务调度程序成功发送,我想从 mailgun 中删除mailgun if any sample's to achieve this?如果有任何样本可以实现这一目标? or any different ideas?或任何不同的想法?

Normally when a bounce happens, providers such as Mailgun will retry a few times depending on the bounce status/type.通常,当退回邮件发生时,Mailgun 等提供商会根据退回邮件的状态/类型重试几次。 After failing to send to that email address, Mailgun will put that address into your Bounces list to avoid sending to that address in the future.在未能发送到该 email 地址后,Mailgun 会将该地址放入您的退回列表,以避免将来发送到该地址。 There's really no point in trying to send emails to an address which doesn't exist, inbox is full, domain expired, etc. So perhaps you should review your bounce list before you consider doing this.尝试将电子邮件发送到不存在的地址、收件箱已满、域已过期等确实没有意义。因此,在考虑这样做之前,也许您应该查看您的退回列表。 Mailgun's dashboard provides the description and date it happened. Mailgun 的仪表板提供了它发生的描述和日期。 If you wish to send to a particular address again, you can remove the address from the bounce list.如果您想再次发送到特定地址,您可以从退回列表中删除该地址。 More about bounces here .更多关于反弹的信息

You can use mailgun-php or simply use Guzzle to call their API to retrieve your bounces.您可以使用mailgun-php或简单地使用Guzzle调用他们的API来检索您的退回邮件。 I'm not sure what you meant my removing email, but hope this helps.我不确定我删除 email 是什么意思,但希望这会有所帮助。

Edit:编辑:

You can use their API to get all your bounces , and also the message content (retention depends on your plan or settings) if you need the original content.如果您需要原始内容,您可以使用他们的 API 获取所有退回邮件,以及邮件内容(保留取决于您的计划或设置)。 You could also use their webhooks to get the failed emails, so you don't really need to schedule/cron.您还可以使用他们的webhook来获取失败的电子邮件,因此您实际上不需要调度/cron。

Edit 2:编辑2:

The bounce list only stores email addresses of previously bounced emails.退回列表仅存储以前退回的电子邮件的 email 地址。 Also, I just realized that, if you're checking hourly for bounced messages, looks like the suppression/bounce API won't be of much help since you can't know if a message has failed for an address already on the list.此外,我刚刚意识到,如果您每小时检查一次退回的邮件,看起来抑制/退回 API 不会有太大帮助,因为您无法知道邮件是否针对已在列表中的地址失败。 This is the only data from bounce list:这是退回列表中的唯一数据:

      {
        "address": "alice@example.com",
        "code": "550",
        "error": "No such mailbox",
        "created_at": "Fri, 21 Oct 2011 11:02:55 GMT"
      },

So looks like you've to use the events API or webhooks to get the failed messages.所以看起来你必须使用事件 APIwebhook来获取失败的消息。 I've used mailgun-php sometime ago, and I found that the it wasn't easy working with Events on that library due to protected properties of the class.前段时间我使用过 mailgun-php ,我发现由于 class 的受保护属性,在该库上使用事件并不容易。 So if you have trouble, maybe just use Guzzle or use webhook approach instead.因此,如果您遇到问题,也许只需使用 Guzzle 或使用 webhook 方法。

声明:本站的技术帖子网页,遵循CC BY-SA 4.0协议,如果您需要转载,请注明本站网址或者原文地址。任何问题请咨询:yoyou2525@163.com.

 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM