ifvalidto

Section: User Commands (1)
Index Return to Main Contents
 

NAME

ifvalidto - check for valid recipient in To:/Cc:; otherwise return with 99, 100, or a custom return code  

SYNOPSIS

ifvalidto [ [-b|-r RC] okaddr ... ]  

DESCRIPTION

ifvalidto reads a mail message from its standard input. It exits 0 if $RECIPIENT is listed in any To or Cc (targeted recipients) field, 99 if not. Addresses are compared without regard to case.

If you list some okaddr's, ifvalidto will use them in place of $RECIPIENT. It exits 99 if none of them are listed in any recipients header fields.

For example, you can put


   |ifvalidto 
   |./Maildir/

into your .qmail file to discard further processing and delivery of mails with a SMTP envelope address targeting you, but lacking a corresponding To or Cc information in the email headers. If ifvalidto is enhanced with the option -b it exits 100, thus you can enable a bounce mode:


   |bouncesaying 'mail not delivered' except ifvalidto
   |./Maildir/

Rather, you may wont to apply a particular spam-catch address:


   |condredirect $LOCAL-spam except ifvalidto
   |./Maildir/

Additionally, you can set a custom return code, provissioning ifvalidto with -r RC where RC is a none-negative return code.

NOTICE: In case you use a virtual domain you need to specify the unaltered recipient address upon call since RECIPIENT is the enhanced address including the virtual domain prefix.

WARNING: ifvalidto will potentially discard any mails originating from mailing lists. However, including your email address together with the usual 'To:' addresss of the mailing list allows to overcome this situation.  

LOGGING

In case the recipient is recognized by ifvalidto, its return code is provided in the qmail-send log.  

SEE ALSO

bouncesaying(1), condredirect(1), iftocc(1), except(1), dot-qmail(5)


 

Index

NAME
SYNOPSIS
DESCRIPTION
LOGGING
SEE ALSO

This document was created by man2html, using the manual pages.
Time: 09:34:17 GMT, July 11, 2025