develooper Front page | perl.qpsmtpd | Postings from June 2006

Re: new patch for 251/551 (~/.redirect)

Thread Previous | Thread Next
From:
Robert Millan
Date:
June 28, 2006 11:11
Subject:
Re: new patch for 251/551 (~/.redirect)
Message ID:
20060628181044.GA13954@khazad.dyndns.org

It's in the wiki now:

  http://wiki.qpsmtpd.org/plugins#other_plugins

Still, would be nice if you could put it in the contrib/ dir.  ;)

On Fri, Jun 23, 2006 at 09:52:46PM +0200, Robert Millan wrote:
> 
> Note that sendmail already supports it, but only in the recieving part.  For
> exim, I have a working patch for the reciever already, and I have plans to do
> the sending part as well.
> 
> > It would be good to put on the wiki though (or  
> > maybe in our contrib/ directory[1]).
> > [1] https://svn.perl.org/qpsmtpd/contrib/
> 
> Sure!  Would you please do that?
> 
> -- 
> Robert Millan

> # This plugin checks for ~/.redirect.  If it exists, it uses the recipient
> # address contained there to inform the sender that this user is actualy
> # somewhere else.  This is specialy useful as an alternative for traditional
> # forwarding because:
> #
> # - It doesn't break when the sender has published SPF records.
> # - It gives the final recipient's MTA a chance to perform its own delivery-time
> #   anti-spam checks (greylisting, spf, etc), in addition to whatever checks we
> #   have (or have not) performed on our side.
> #
> # Note that ATTOW most senders will not automaticaly redirect their mail to the
> # final recipient.  In that case, a sane MTA would generate an MDN, informing
> # the user of the new recipient address.  RFC 2821 says that you must not assume
> # this will actualy happen, though, so you do it on your own responsability.
> #
> # See RFC 2821, section 3.4, for details.
> 
> use Qpsmtpd::DSN;
> use File::HomeDir;
> 
> sub hook_rcpt {
>   my ($self, $transaction, $recipient) = @_;
> 
>   if (open (REDIR, home(lc($recipient->user)) . "/.redirect")) {
>     my ($redir) = <REDIR>;
>     close(REDIR);
>     chomp ($redir);
> 
>     if (-f home(lc($recipient->user)) . "/.forward") {
>       $self->qp->respond(251, "User not local; will forward to <$redir>");
>     } else {
>       $self->qp->respond(551, "User not local; please try <$redir>");
>     }
> 
>     return DONE;
>   }
> 
>   return OK;
> }


-- 
Robert Millan

Thread Previous | Thread Next


nntp.perl.org: Perl Programming lists via nntp and http.
Comments to Ask Bjørn Hansen at ask@perl.org | Group listing | About