about summary refs log tree commit
diff options
context:
space:
mode:
authorGraham Barr <gbarr@pobox.com>2006-08-07 17:24:35 +0000
committerGraham Barr <gbarr@pobox.com>2009-02-24 10:40:47 -0600
commit59799cf5bd09045697a9dcbfc429ee96cefb2674 (patch)
tree6e1acfc962119f78740aff509f36be1478ce88f1
parent1ed5b6f05ec35da49417920c6402c9610829b1b1 (diff)
downloadperl-libnet-59799cf5bd09045697a9dcbfc429ee96cefb2674.tar.gz
Added support for ORCPT
-rw-r--r--Net/SMTP.pm20
1 files changed, 19 insertions, 1 deletions
diff --git a/Net/SMTP.pm b/Net/SMTP.pm
index a722f6b..8069f88 100644
--- a/Net/SMTP.pm
+++ b/Net/SMTP.pm
@@ -16,7 +16,7 @@ use IO::Socket;
 use Net::Cmd;
 use Net::Config;
 
-$VERSION = "2.29";
+$VERSION = "2.30";
 
 @ISA = qw(Net::Cmd IO::Socket::INET);
 
@@ -382,6 +382,18 @@ sub recipient
         }
       }
 
+     if(defined($v = delete $opt{ORcpt}))
+      {
+       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)
                 . ' - ignored'
@@ -732,6 +744,7 @@ The C<recipient> method can also pass additional case-sensitive OPTIONS as an
 anonymous hash using key and value pairs.  Possible options are:
 
   Notify  => ['NEVER'] or ['SUCCESS','FAILURE','DELAY']  (see below)
+  ORcpt   => <ORCPT>
   SkipBad => 1        (to ignore bad addresses)
 
 If C<SkipBad> is true the C<recipient> will not return an error when a bad
@@ -778,6 +791,11 @@ any conditions."
 
   $smtp->recipient(@recipients, { Notify => ['FAILURE','DELAY'], SkipBad => 1 });  # Good
 
+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.
+
 =item to ( ADDRESS [, ADDRESS [...]] )
 
 =item cc ( ADDRESS [, ADDRESS [...]] )