Subject: | New options request for Net::SMTP to complete a DSN and AUTH support |
This is a rather straightforward feature request to Net::SMTP
(from the author of a content filter amavisd-new, which relies
heavily on Net::SMTP).
Now that Postfix supports DSN and amavisd-new 2.4.0 does supports it
too, a missing link is an option for recipient() to set ORCPT in the
RCPT TO command. Seems like DSN support was intended to be there, but
the implementation stopped just short of this goal by forgetting a
need for ORCPT, required by RFC 3461.
Similarly, the support for RFC 2554 (AUTH) fell one short step short
of the goal, by forgetting an option AUTH=submitter to MAIL FROM.
I'm attaching a patch which adds these missing options. I would be
very happy if at least ORCPT would see its light in a forseeable
future, as without it I can not claim that amavisd-new fully supports
DSN.
While at it, the patch adds one more option, which is ENVID.
It is functionally equivalent to the option Envelope, but it does
not do xtext encoding itself, instead it relies on the caller to
supply correctly encoded value. (the same approach I used for ORCPT).
The reason is that the original recipient should preferably be passed
through mailers unchanged, respecting the original submitter's wishes
of xtext encoding characters which MAY but NEED NOT be encoded, and
respecting upper/lowercase characters choice for hex digits. The use
of option Envelope makes impossible to respect submitter's will and
unnecessarily modifies envelope of passing mail.
I see there are a couple of small changes to libnet on the author's
CVS site, so this might be a good opportunity for a smallish
maintenance release (and keep customers happy:)
Best regards (too Graham in particular),
Mark
Subject: | SMTP.pm.patch |
--- SMTP.pm~ Wed Jun 30 15:56:11 2004
+++ SMTP.pm Fri Mar 31 01:58:26 2006
@@ -17,5 +17,5 @@
use Net::Config;
-$VERSION = "2.29";
+$VERSION = "2.30";
@ISA = qw(Net::Cmd IO::Socket::INET);
@@ -300,5 +300,5 @@
}
- if(defined($v = delete $opt{Envelope}))
+ if(defined($v = delete $opt{Envelope})) # xtext-encode here
{
if(exists $esmtp->{DSN})
@@ -313,4 +313,32 @@
}
+ if(defined($v = delete $opt{ENVID}))
+ {
+ # expected to be in a format as required by RFC 3461, xtext-encoded
+ if(exists $esmtp->{DSN})
+ {
+ $opts .= " ENVID=$v"
+ }
+ else
+ {
+ carp 'Net::SMTP::mail: DSN option not supported by host';
+ }
+ }
+
+ if(defined($v = delete $opt{AUTH}))
+ {
+ # expected to be in a format as required by RFC 2554,
+ # rfc2821-quoted and xtext-encoded, or <>
+ if(exists $esmtp->{AUTH})
+ {
+ $v = '<>' if !defined($v) || $v eq '';
+ $opts .= " AUTH=$v"
+ }
+ else
+ {
+ carp 'Net::SMTP::mail: AUTH option not supported by host';
+ }
+ }
+
if(defined($v = delete $opt{XVERP}))
{
@@ -383,4 +411,17 @@
}
+ if(defined($v = delete $opt{ORCPT}))
+ {
+ # expected to be in a format as required by RFC 3461, xtext-encoded
+ if(exists $esmtp->{DSN})
+ {
+ $opts .= " ORCPT=" . $v;
+ }
+ else
+ {
+ carp 'Net::SMTP::recipient: DSN option not supported by host';
+ }
+ }
+
carp 'Net::SMTP::recipient: unknown option(s) '
. join(" ", keys %opt)
@@ -709,6 +750,8 @@
Bits => "7" | "8" | "binary"
Transaction => <ADDRESS>
- Envelope => <ENVID>
+ Envelope => <ENVID> # xtext-encodes its argument
+ ENVID => <ENVID> # similar to Envelope, but expects argument encoded
XVERP => 1
+ AUTH => <submitter> # encoded address according to RFC 2554
The C<Return> and C<Envelope> parameters are used for DSN (Delivery