Sponsored Content
Top Forums Shell Programming and Scripting Email address verification script Post 302102834 by Ramdas on Sunday 14th of January 2007 07:08:23 AM
Old 01-14-2007
Email address verification script

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
 

10 More Discussions You Might Find Interesting

1. UNIX for Dummies Questions & Answers

Send email where # is in the email address - Using Unix

Hi All, How do I send an email using malix where email address contains a #. I have a email address like this : #test@test.com I want to send email like malix -s "TEST" #test@test.com < SOMEFILE I tried \# but doesn't work. Please let me know how we can achieve this? I am in... (1 Reply)
Discussion started by: jingi1234
1 Replies

2. UNIX for Dummies Questions & Answers

Verification of a script already running - where to do it

Hi, I have a script I want to run as a background process. Where would I add a bit of script so that a check can be performed to see it this is already running and, where it isn't, to then run it? I know how to do this... I just don't know where I can put the initial part of the check script so... (2 Replies)
Discussion started by: miwinter
2 Replies

3. Shell Programming and Scripting

EMail Address Validation (Shell Script)

Hi, Can anyone provide me the code snippet for EMail Address Validation. User is going to enter the email address in form window. I need to validate the format is correct. Thanks in Advance BS (3 Replies)
Discussion started by: balajiora
3 Replies

4. Shell Programming and Scripting

UNIX Script to query Active Directory: give cn (NT login name) and receive mail (Email address)

Hi folks I need to write UNIX script (with ldapsearch) to query Active Directory. Input is NT login name and output is Email address. Attached a screenshot of Sysinternals "AD Explorer". I need to do the same in CLI. http://i.imgur.com/4s6FB.png I am absolute LDAP/ldapsearch noob. (0 Replies)
Discussion started by: slashdotweenie
0 Replies

5. Shell Programming and Scripting

how to write script to change email address

we have 4000 html pages that need an email address changed. eg) company@yahoo.com to company@hotmail.com we only want the file modified date to be changed when there has been a change to the file. Should I be using grep? I fairly new to UNIX and was told to using something like... (2 Replies)
Discussion started by: mchelle_99
2 Replies

6. Shell Programming and Scripting

Script Verification

Hi eveyone I am planning to use crontab to delete all files in my donwloads directory that are older than one hour I will be using crontab to run this script find /home/kee/downloads/* -daystart -mmin +59 -type f -name -exec rm -r {}\; could you please let me know if the above... (1 Reply)
Discussion started by: k33k00
1 Replies

7. Shell Programming and Scripting

Sending email from a script & specifying the "from" address

Hello all, I have a requirement to send an email from a shell script. Simple enough. A google search gives thousands of examples. But here's the catch. I need to be able to specify the "from" address, and none of the examples I've found allow for that. When I used the mail or mailx commands,... (2 Replies)
Discussion started by: lupin..the..3rd
2 Replies

8. Shell Programming and Scripting

Verification on shell script

hello i have writing a shell script to download and run some packages the only way that i use to verify download pack is , limit users ip to download from main server, if wget can download file (verified) then script run by execute it sh pack76.sh else show and error (stupid solution ha?) ... (8 Replies)
Discussion started by: nimafire
8 Replies

9. Shell Programming and Scripting

Field verification script help

Hello again unix.com I need some help regarding a script. I have: function checkform ( form ) { if (form.pass.value.length < 6) { alert( "Error." ); form.pass.focus(); document.getElementById('pass').style.backgroundColor="#FFFFFF"; return... (2 Replies)
Discussion started by: galford
2 Replies

10. OS X (Apple)

SHA1 verification script

Hi guys! Me again! ... I'm trying to build (on MacOS directly) a bash script that will help me verify a SHA1 digest (to verify downloads and so on and so forth). So first off, here's my version of BASH under OSX: bash-4.4$ And here's my version of Sierra (macOS): 10.12.3 (16D32) ... (2 Replies)
Discussion started by: Ardzii
2 Replies
qmail-verify(8) 						       v1.32							   qmail-verify(8)

NAME
qmail-verify - Address verification daemon SYNOPSIS
qmail-verify DESCRIPTION
qmail-verify receives UDP packets containing local email addresses and returns a single byte to indicate if the address is valid or invalid to the sender of the UDP packet. qmail-smtpd or qmail-qmtpd are typical clients using the qmail-verify service, although at present only qmail-smtpd has had this functionality added. qmail-verify is based on Paul Jarc's realrcptto patch for qmail (http://code.dogmap.org/qmail/). qmail-verify uses the files control/locals, control/virtualdomains, users/cdb, the system password file entries (typically in /etc/passwd ) as well as the existence or not of users' home directories and .qmail[-xxx] files to determine if a given address is valid. Where a qmail system uses .qmail-default files on a per-domain basis in a virtual domains setup, this is likely to result in all addresses being considered 'valid'. This may not in fact be the case in certain situations, such as with extensions/adaptations to qmail like vpop- mail which use .qmail-default files throughout (delivery in this case is subsequently handled by a vpopmail component). In these cases a replacement for qmail-verify will be required that can determine address validity. Other customised qmail installations that use different methods to locate users' mailboxes are likely to need alternatives to qmail-verify or a modified version of it for address verification. INVOCATION
qmail-verify should be invoked as user root to have sufficient privileges to determine the validity of a given address. In certain single- UID virtual domains setups, it may be sufficient to run qmail-verify as the single-UID. By default, qmail-verify listens on localhost (127.0.0.1) on port 11113. This behaviour can be changed by setting the environment variable LISTEN to specify the IP address and/or port: Set this to the desired IP address, optionally followed by a colon and port, thus for example LISTEN="192.168.1.1:10101". ADDRESS VERIFICATION DETAILS
qmail-verify is implemented by taking the various pieces of qmail that parse an address and combining them in the same executable, qmail- verify. Thus logic is taken from qmail-send, qmail-lspawn, qmail-getpw and qmail-local. UDP PACKET DETAILS
The incoming packet contains just the email address to be checked as a string. The string is optionally terminated with a 0 byte. The response packet contains a single byte to indicate whether the address is valid. The lowest-order bit of this byte indicates the result: 0 for 'valid', 1 for 'invalid'. Other bits of this response byte are set by qmail-verify to give further debugging information; these other bits should generally be disregarded. Although not especially designed as a new protocol, extensions to qmail-verify could require the query string to be 0 terminated to sepa- rate it from other data to follow. Currently the response packet contains the response byte and the 'Controlling user'; more information could potentially be returned if required. CONTROL FILES
At startup qmail-verify reads the following qmail control files: control/envnoathost, control/locals, control/percenthack, control/virtual- domains. If changes are made to any of these files, qmail-verify should be restarted for the changes to take effect in qmail-verify. If you are using different machines for qmail-verify and qmail-smtpd you should ensure that the machine providing the qmail-verify service has a full set of control files as well as the mailboxes; the machine running qmail-smtpd still needs control/rcpthosts to be setup. LOGGING
qmail-verify logs each decision it makes to stderr: The address followed by whether it's valid or not. AUTHOR
Andrew Richards, building on the work of Paul Jarc and Dan Bernstein, and with plenty of help along the way from Russell Nelson, John Levine and Charles Cazabon amongst others. SEE ALSO
qmail-smtpd(8). 28th August 2009 Andrew Richards qmail-verify(8)
All times are GMT -4. The time now is 04:20 AM.
Unix & Linux Forums Content Copyright 1993-2022. All Rights Reserved.
Privacy Policy