about summary refs log tree commit
diff options
context:
space:
mode:
authorGraham Barr <gbarr@pobox.com>2007-02-10 13:08:59 +0000
committerGraham Barr <gbarr@pobox.com>2009-02-24 10:40:47 -0600
commit6ce1e6228c272aa83558dcbbe62d95c93d227f76 (patch)
treea1e926278e77bc2f66255eba1dc19257f9294ce7
parent1f1210413a5f03861f4a03cf12e199a36b5a467b (diff)
downloadperl-libnet-6ce1e6228c272aa83558dcbbe62d95c93d227f76.tar.gz
RT#18456 Add support for ENVID and AUTH. Patch by Mark Martinec
-rw-r--r--Net/SMTP.pm38
1 files changed, 36 insertions, 2 deletions
diff --git a/Net/SMTP.pm b/Net/SMTP.pm
index 8069f88..3b8494e 100644
--- a/Net/SMTP.pm
+++ b/Net/SMTP.pm
@@ -16,7 +16,7 @@ use IO::Socket;
 use Net::Cmd;
 use Net::Config;
 
-$VERSION = "2.30";
+$VERSION = "2.31";
 
 @ISA = qw(Net::Cmd IO::Socket::INET);
 
@@ -312,6 +312,34 @@ sub mail
         }
       }
 
+     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}))
       {
        if(exists $esmtp->{'XVERP'})
@@ -720,12 +748,17 @@ in hash like fashion, using key and value pairs.  Possible options are:
  Return      => "FULL" | "HDRS"
  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
 Status Notification).
 
+The submitter address in C<AUTH> option is expected to be in a format as
+required by RFC 2554, in an RFC2821-quoted form and xtext-encoded, or <> .
+
 =item reset ()
 
 Reset the status of the server. This may be called after a message has been
@@ -795,6 +828,7 @@ ORcpt is also part of the SMTP DSN extension according to RFC3461.
 It is used to pass along the original recipient that the mail was first
 sent to.  The machine that generates a DSN will use this address to inform
 the sender, because he can't know if recipients get rewritten by mail servers.
+It is expected to be in a format as required by RFC3461, xtext-encoded.
 
 =item to ( ADDRESS [, ADDRESS [...]] )