Does altermime interface support dropping an email?

Mark Martinec Mark.Martinec+amavis at
Mon Oct 10 21:25:53 CEST 2011


> I have a requirement for additional processing of outgoing emails
> apart from normal spam and virus handling. Depending on SA rules hit I
> need to either modify the email body, drop the message (and save the
> message content for records) or just pass it through.
> I am planning to use the  altermime interface to call an external
> program which will go through the SA rules in email headers and take
> appropriate action.
> In this scenario is it possible to drop a message completely using an
> altermime interface?

No, unfortunately it is not currently possible for the altermime interface
to drop a message entirely, it can only modify a passed message.

First, I don't see a reliable way for altermime (or its lookalike) to
pass back such a requirement, and secondly the mail mangling
comes late in the program flow: it happens at the time of delivery
(possibly per-recipient), after all the decisions regarding pass/block
and quarantining have already been made.

You may be able to drop a message based on some other characteristic
which is available independently of altermime.

> Does amavis provide any other interface to call
> an external program capable of modifying or dropping an email?
> My question was that if it is possible for a program called from
> altermime interface to just drop a mail, no quarantine or bounce. I am
> aware that amavisd-new is capable of quarantining an email, but could
> not find any information regarding dropping an email from a program
> called using altermime interface.

A custom hook can achieve this: you are allowed to replace
a message stored on a file pointed to by a file handle
kept in $msginfo->mail_text . I think I posted some examples
in the past, I can dig them up if necessary.


More information about the amavis-users mailing list