Anilkumar wrote:
> Dear John,
>   Thanks again, i have sucessfully written a plugin.

As I posted in an earlier message, this is all that is required (with the tip of
branches/0.31):

sub hook_mail {
  my ($self, $transaction, $sender, $header) = @_;

  my $auth_user = $self->auth_user();

  if ( $auth_user && $sender ne $auth_user ) {
      return (DENY,
          "Hey! You Can't change your From E-mail ID, Please Use E-mail ID:
$auth_user");
  }
  else {
      return DECLINED;
  }
}

There are a number of reasons why this version is better:

1) You don't need to use register() any more;
2) You can directly compare $sender without extracting the host and user;
3) You must explicitely return DECLINED if you want the pass the message.

John

Reply via email to