如何在sails.js中跟踪退回的电子邮件或未送达的电子邮件 [英] how to keep track of bounced emails or undelivered emails in sails.js

查看:70
本文介绍了如何在sails.js中跟踪退回的电子邮件或未送达的电子邮件的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

我正在使用 nodemailer 发送邮件.

I am using nodemailer to send mails.

我的要求是跟踪退回的电子邮件或未送达的电子邮件.

My requirement is to keep track of bounced emails or undelivered emails.

怎么做?请帮忙

推荐答案

在当前配置中,您无法轻松做到这一点.如果邮件已送达或收件人不可用,邮件功能不会立即返回.邮件刚刚被 SMTP 服务器接受,然后您的脚本继续运行.SMTP 服务器(在后台以异步方式)尝试发送邮件(可能多次),并且只有在失败时才会发送回邮件.

You cannot do this easily in the current configuration. The mail functions do not return immediately, if a mail was delivered or the recipient is unavailable. The mail is just accepted by the SMTP server and then your script goes on. The SMTP server (in the background and asynchronously) tries to send the mail (likely multiple times) and only if it fails, sends a mail back.

您收到的这封邮件正是您感兴趣的邮件.

This mail you get back is the one which you are interested in.

您使用的 MDA/MTA(例如 sendmail)应配置为将传入邮件传递到您设置的脚本中.这样你的脚本就会自动启动,如果有你感兴趣的新邮件.如何配置你的 MDA/MTA 是 已经回答.

The MDA/MTA you use (for example sendmail) should be configured to pass on incoming mails into a script you set up. This way your script gets automatically started, if there come in new mails you are interested in. How to configure your MDA/MTA was already answered.

如果这有效,您需要解析"邮件.我认为邮件是作为标准输入流提供给您的脚本的.您可以使用 process.stdin 访问这个.然后,您必须检查邮件是否有错误、退回或您感兴趣的任何内容,并可能将收件人的状态保存在数据库中.

If this works, you need to "parse" the mail. I think the mail is provided to your script as standard input stream. You can access this one with process.stdin. You must then check the mail for errors, bounces, or whatever you are interested in and can possibly save the status of the recipient in a database.

这篇关于如何在sails.js中跟踪退回的电子邮件或未送达的电子邮件的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

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