重组SMTP邮件

时间:2019-06-15 17:07:24

标签: node.js smtp postfix-mta

我正在构建Postfix邮件服务器,并且尝试使用before-queue content filter方法:

enter image description here

我使用Node.js编写代理,并使用node-mailin来解析传入的消息并检查有效性(根据某些条件)。
但是,在解析消息并意识到它是有效的之后,我很难将其传递给Postfix清理服务器(图表中的第4个框)。

const nodeMailin = require("node-mailin");

nodeMailin.start({
  port: 10025,
    smtpOptions: {
    name: 'mail.mydomain.com'
  }
});

// Event called after a message was received and parsed.
// 'data' is the JSON parsed message, 'content' is the raw message.
nodeMailin.on("message", function(connection, data, content) {
  if (data.attachments && data.attachments.length > 2) {
    console.log('Has removed an invalid message');
  }
  else {
    // Valid message. I should pass it on
  }
});

nodeMailin.on("error", function(error) {
  console.log(error);
});

我不确定如何重新构成遵循SMTP协议的邮件,而不忽略原始邮件中的数据。 我还应该提到,在某些情况下,我必须传递带有附件的邮件。

(所有发生在具有Amazon Linux AMI的EC2实例上)

0 个答案:

没有答案