开发者

Using Perl to send emails directly to recipients mail servers

开发者 https://www.devze.com 2023-02-03 23:56 出处:网络
I need to write a small Perl application to send email directly to the recipients\' mail servers.I can\'t use a local mail server because I need 开发者_如何学编程to know about email errors immediately

I need to write a small Perl application to send email directly to the recipients' mail servers. I can't use a local mail server because I need 开发者_如何学编程to know about email errors immediately when they happen.

I know about Email::Sender and Net::SMTP, but are there any Perl modules that will handle the MX lookups, and possibly even the retries?


Very few SMTP servers, today, would accept mail from stand alone machines not configured as Relays - especially if they do not reverse resolve to the sending domains MX record. However if you are willing to wait for a (configurable) short time to know what happened to your email, here are a few options that you could consider on a properly configured SMTP Relay:

  1. Use a Daemon that scans the mail log (for example if you are using Postfix look at: Mail::Log::Parse::Postfix and logs each entry some place that your program can access
  2. Again using Postfix as an example, keep the deferred deadline very short so that deferred mail is bounced
  3. Add a Custom Header to your mails so that a POP daemon can track bounces possibly using Mail::DeliveryStatus::BounceParser

I know thats a lot of work for something seemingly simple as checking what happens to your email, but this is the best you can do if you insist on not using Net::SMTP :) while also avoiding the risk of SMTP servers refusing your mail

0

精彩评论

暂无评论...
验证码 换一张
取 消