Permalink
Browse files

Initial version of plugin

  • Loading branch information...
1 parent 31afee8 commit 318544e65c232d759c80d852ad959d9ad9273be0 Robin Bowes committed Jul 20, 2011
Showing with 26 additions and 0 deletions.
  1. +26 −0 qmail-ext-convert
View
@@ -0,0 +1,26 @@
+#!/usr/bin/env perl
+
+use strict;
+use warnings;
+
+sub hook_rcpt {
+
+ my ($self, $transaction) = (shift, shift);
+
+ my $orig_user = $_[0]->user();
+ my $domain = $_[0]->host();
+
+ my $user = $orig_user;
+
+ # replace the first instance of "-" with "+"
+ $user =~ s/-/+/;
+
+ if ($orig_user ne $user) {
+ my $old = "<" . $orig_user . '@' . $domain . ">";
+ my $new = "<" . $user . '@' . $domain . ">";
+ $_[0] = Qpsmtpd::Address->new($new);
+ $self->log(LOGINFO, "qmail-ext-convert: replaced $old with $new");
+ }
+
+ return (DECLINED);
+}

0 comments on commit 318544e

Please sign in to comment.