Skip to content

Commit

Permalink
Initial version of plugin
Browse files Browse the repository at this point in the history
  • Loading branch information
Robin Bowes committed Jul 20, 2011
1 parent 31afee8 commit 318544e
Showing 1 changed file with 26 additions and 0 deletions.
26 changes: 26 additions & 0 deletions qmail-ext-convert
@@ -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.