[Mimedefang] md_check_against_smtp_server and md_graphdefang_log

James Curtis jameswcurtis at hotmail.com
Wed Mar 27 10:05:09 EDT 2013

>Date: Wed, 27 Mar 2013 12:19:30 schmidt at phoenixsoftware.de
>I told you not to remove the first line
>my($recip, $sender, ...) = @_;
>Without that line, the $sender and $recip variables will not be set,
>so your md_check_against_smtp_server call will try to check an empty
>I also told you to compare $retval to "REJECT" in all capitals in
>your if statement because that's what md_check_against_smtp_server
>will return. As it stands, the comparison will never be true so
>the else branch will always be run.
>And finally I told you to insert a return statement before the
>closing brace. The code above will return an empty result, which
>the caller doesn't expect.
>Btw, "return action_discard" is not appropriate in filter_recipient
>either. It should be something like "return('REJECT', 'You lose!');".
>> Having tried with the remarked statement and having it fail, I remarked it back to just ther >ecommended line and it still fails all email address', whether valid or not valid with this response:
>> 501 5.5.4 Invalid Address
>And quite rightly so. The empty address is indeed invalid as a
>recipient. :-)
>In sum, try something like this: (Sorry for the line wraps.)
>sub filter_recipient
(redacted for brevity) ...

Thanks for the thorough explanation.  I had spent some time looking at the mimedefang.pl script (specifically the interaction between md_check_against_smtp_server and watching how it calls get_smtp_return_code) and I was getting close.  
I put in the code as you provided, but it still doesn't log anything (either valid or notauser) into the md_graphdefang_log.  However I did find this in my /var/log/maillog
Mar 27 09:59:40 monitor mimedefang.pl[23405]: md_graphdefang_log called outside of message context


More information about the MIMEDefang mailing list