Hi Group,
Please forgive in case this is discussed.
I need help regarding a simple script to verify if the give address exist in the Ldap directory. If the email exists the script should exit with a 0 status or else a non zero status.
I am currently using the following script (and it is working ).
-----
# cat email_rcpt.sh
#!/bin/bash
# Email verification
sleep 1
LDAP_LOOKUP="/var/qmail/bin/qmail-ldaplookup -m"
EMAIL=$1
export $LDAP_LOOKUP $EMAIL
$LDAP_LOOKUP $EMAIL
---------------------------------
# ./email_rcpt.sh
foo@bar.com
# echo $?
# 0
----
This script is working correctly. Except that I have a few domains which have catchall addresses & a few whoes email addresses are not maintained in our LDAP ( external domains). I have a file called /var/qmail/control/goodmailaddr which has list of all such domains whoes email address verifications is skipped .
I need to some how modify the above script to recognise this file . My current work-around for this problem is by adding an catchall entry of all the external domains in my LDAP.
Here is how I need to do this .
when the email address is supplied as argument split the domain part and check if it is present in the goodmailaddr file. If present exit with 0 , if not continue with the lookup.
Thanx in advance for help
Regards
Ram