Check an email domain

19 views
Skip to first unread message

hofar...@houseoffusion.com

unread,
Oct 10, 2013, 2:25:34 PM10/10/13
to ColdFusion Technical Talk

Hi,
I just lost about 2 hours digging in my mail server logs to find why a user did not get his message sent by CF to finally find out the guy entered a typo in his domain name...

So, I know that verifying that an email address exists is utopic, but verifying that at least some mail server exists for a certain domain name would have saved me 2 hours this morning!

Is someone aware of some tool that will check for a mail server from CF?

Thanks.


~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~|
Order the Adobe Coldfusion Anthology now!
http://www.amazon.com/Adobe-Coldfusion-Anthology/dp/1430272155/?tag=houseoffusion
Archive: http://www.houseoffusion.com/groups/cf-talk/message.cfm/messageid:356904

hofar...@houseoffusion.com

unread,
Oct 10, 2013, 2:29:13 PM10/10/13
to ColdFusion Technical Talk

> Is someone aware of some tool that will check for a mail server from CF?

I don't know that, it would be a nice feature... but I do know if you put yourself as the "failto" address in CFMAIL that will give you a much easier way to see failed mail then digging through the mail server. I generally use that just to help keep my mail list clean anyway.

Robert Harrison
Director of Interactive Services

Austin & Williams
Advertising�I Branding�I�Digital�I�Direct �
125 Kennedy Drive, �Suite 100 ��I �Hauppauge, NY 11788
T 631.231.6600 X 119 ��F 631.434.7022
http://www.austin-williams.com

Blog: http://www.austin-williams.com/blog
Twitter: http://www.twitter.com/austin_williams
Archive: http://www.houseoffusion.com/groups/cf-talk/message.cfm/messageid:356905

hofar...@houseoffusion.com

unread,
Oct 10, 2013, 2:36:09 PM10/10/13
to ColdFusion Technical Talk

> Is someone aware of some tool that will check for a mail server from CF?

There's a CFC that will look up MX records (among other things). You
could use that to see if there are corresponding MX records for a
given domain - it would not tell you whether there was actually a
server accepting email.

http://foundeo.com/fusionkit/dns-cfc-docs.cfm

It's $25.

Dave Watts, CTO, Fig Leaf Software
http://www.figleaf.com/
http://training.figleaf.com/

Fig Leaf Software is a Veteran-Owned Small Business (VOSB) on
GSA Schedule, and provides the highest caliber vendor-authorized
instruction at our training centers, online, or onsite.

~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~|
Order the Adobe Coldfusion Anthology now!
http://www.amazon.com/Adobe-Coldfusion-Anthology/dp/1430272155/?tag=houseoffusion
Archive: http://www.houseoffusion.com/groups/cf-talk/message.cfm/messageid:356906

hofar...@houseoffusion.com

unread,
Oct 10, 2013, 3:35:12 PM10/10/13
to ColdFusion Technical Talk

You need to use nslookup, you can do this via cfexecute or via java or
there are cfx tags out there

Russ Michaels
www.michaels.me.uk
cfmldeveloper.com
cflive.net
cfsearch.com
Archive: http://www.houseoffusion.com/groups/cf-talk/message.cfm/messageid:356907

hofar...@houseoffusion.com

unread,
Oct 10, 2013, 4:38:21 PM10/10/13
to ColdFusion Technical Talk

>>You need to use nslookup

Yes, this is what I end up doing.
Here is a function that returns the name of the mail server id there is on, or an empty string if there is not.
(tested on Windows)


<CFFUNCTION NAME="nslookup">
<CFARGUMENT NAME="domain" REQUIRED="yes" TYPE="string">
<CFEXECUTE name="c:\windows\system32\nslookup.exe"
arguments=" -type=mx #domain#"
variable="this.nslookup"
timeout="10" />
<CFSET n = findNoCase ("mail exchanger = ", this.nslookup)>
<CFIF n EQ 0>
<CFRETURN "">
<CFELSE>
<CFRETURN mid (this.nslookup, n+17, 9999)>
</CFIF>
</CFFUNCTION>

<CFOUTPUT>houseoffusion.com = #nslookup("houseoffusion.com")#<BR>
homeoffusion.com = #nslookup("homeoffusion.com")#
</CFOUTPUT>



~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~|
Order the Adobe Coldfusion Anthology now!
http://www.amazon.com/Adobe-Coldfusion-Anthology/dp/1430272155/?tag=houseoffusion
Archive: http://www.houseoffusion.com/groups/cf-talk/message.cfm/messageid:356908

hofar...@houseoffusion.com

unread,
Oct 10, 2013, 4:57:38 PM10/10/13
to ColdFusion Technical Talk

Hi Claude,

I use CFX_validEmail. Sample code below. It is reliable, but because of
the time outs it can take a long time on large tables.

Some stuff in the code related to how I was using it, of course, but I think
it will help rather than hinder so I've left it intact.

Hope this helps,
Jenny

<CFX_ValidEmail QUERY="QUERY_NAME "
COLUMN="EMAIL_TO_CHECK "
IDCOLUMN="ID_COLUMN "
NAME="results"
MXTIMEOUT="5"
SMTPTIMEOUT="5"
FROMADDRESS="so...@email.com "
MXLOOKUP
USEMXCACHE
USESMTPCHK
CLEARMXCACHE>

<cfdump var="#results#">

<cfoutput query="results">
<cfquery datasource="#application.dsn#">
update tbl_members
set emailVerify = '#results.smtpchk#', emailVerifyMessage =
'#results.SMTPRESPONSE#'
<cfif results.smtpchk is "yes">
, emailverified = '#results.address#', emailVerifyDate = getdate()
</cfif>
where memberID = #results.idcolumn#
</cfquery>
</cfoutput>


-----Original Message-----
From: Claude Schn�egans <schne...@internetique.com>
[mailto:=?ISO-8859-1?Q?Claude_Schn=E9egans <schneegans@interneti=71?=
=?ISO-8859-1?Q?ue.com=3E?=]
Sent: 10 October 2013 19:26
To: cf-talk
Subject: Check an email domain


Archive: http://www.houseoffusion.com/groups/cf-talk/message.cfm/messageid:356909

hofar...@houseoffusion.com

unread,
Oct 10, 2013, 5:00:30 PM10/10/13
to ColdFusion Technical Talk

NSlookup is good if you only need to know the server. CFX_ValidEmail also
checks if the use exists. I use it to avoid duff mail addresses producing
spam triggers, it can save a user needing a registration confirmation email
- which can cause spam triggers themselves.

-----Original Message-----
From: Claude Schn�egans <schne...@internetique.com>
[mailto:=?ISO-8859-1?Q?Claude_Schn=E9egans <schneegans@interneti=71?=
=?ISO-8859-1?Q?ue.com=3E?=]
Archive: http://www.houseoffusion.com/groups/cf-talk/message.cfm/messageid:356910

hofar...@houseoffusion.com

unread,
Oct 10, 2013, 5:35:24 PM10/10/13
to ColdFusion Technical Talk

Thanks, but the notice "All our CFX tags and tools are for the Windows platform only." makes me think this tag is written in C, not Java.

I am hesitating installing new tags on my server.
Although I have a 64bit server, I had to install the 32 bit version of CF because of some heritage CFXs, and I don't want to add mode 32 bit tags.
Unless there exists both 32 bit and 64 bit for this tag.



~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~|
Order the Adobe Coldfusion Anthology now!
http://www.amazon.com/Adobe-Coldfusion-Anthology/dp/1430272155/?tag=houseoffusion
Archive: http://www.houseoffusion.com/groups/cf-talk/message.cfm/messageid:356911

hofar...@houseoffusion.com

unread,
Oct 10, 2013, 6:01:41 PM10/10/13
to ColdFusion Technical Talk

> NSlookup is good if you only need to know the server. CFX_ValidEmail also
> checks if the use exists. I use it to avoid duff mail addresses producing
> spam triggers, it can save a user needing a registration confirmation email
> - which can cause spam triggers themselves.

Unfortunately, there isn't really a reliable way to check if a user
exists other than sending an email to that address and getting a
response. Mail servers can be configured to blackhole messages sent to
invalid addresses, for example.

http://stackoverflow.com/questions/3024819/how-do-i-check-if-an-email-address-is-valid-without-sending-anything-to-it

http://en.wikipedia.org/wiki/Callback_verification

Dave Watts, CTO, Fig Leaf Software
http://www.figleaf.com/
http://training.figleaf.com/

Fig Leaf Software is a Veteran-Owned Small Business (VOSB) on
GSA Schedule, and provides the highest caliber vendor-authorized
instruction at our training centers, online, or onsite.

~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~|
Order the Adobe Coldfusion Anthology now!
http://www.amazon.com/Adobe-Coldfusion-Anthology/dp/1430272155/?tag=houseoffusion
Archive: http://www.houseoffusion.com/groups/cf-talk/message.cfm/messageid:356912

hofar...@houseoffusion.com

unread,
Oct 10, 2013, 6:35:13 PM10/10/13
to ColdFusion Technical Talk

>>Unfortunately, there isn't really a reliable way to check if a user
exists other than sending an email to that address and getting a
response.

Right, and I even add
and getting a response... from a user who knows that he has a spam folder somewhere and who knows how to look in it.

But I'm not looking for a 100% sure test, only for the best possible elimination of bad adresses.
I have added my nslookup test called by Ajax in my email validating function and it works well.
Before it only checked that the address was syntaxically correct, know, it also checks that there is a mail server at the domain.


~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~|
Order the Adobe Coldfusion Anthology now!
http://www.amazon.com/Adobe-Coldfusion-Anthology/dp/1430272155/?tag=houseoffusion
Archive: http://www.houseoffusion.com/groups/cf-talk/message.cfm/messageid:356913

hofar...@houseoffusion.com

unread,
Oct 10, 2013, 6:37:31 PM10/10/13
to ColdFusion Technical Talk

>>I use it to avoid duff mail addresses producing
spam triggers

Do you know that checking if a user exists without actually sending a message can also tag you as a potential spammer?



~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~|
Order the Adobe Coldfusion Anthology now!
http://www.amazon.com/Adobe-Coldfusion-Anthology/dp/1430272155/?tag=houseoffusion
Archive: http://www.houseoffusion.com/groups/cf-talk/message.cfm/messageid:356914

hofar...@houseoffusion.com

unread,
Oct 15, 2013, 11:14:35 AM10/15/13
to ColdFusion Technical Talk

Just to be clear, CFX_ValidEmail is my tag. It was written in Delphi 7 and
interfaces to CF through the C++ interface. All of the CFX tags I built are
32-bit only and unlikely to ever get an upgrade. They were all written at
the time of CF4 and have had bug fixes and maintenance for them since that
time but I'd recommend finding alternatives these days.

To that end, I've been moving over the more popular of my CFX tags to have
CF/Java replacements and although I haven't got around to doing
CFX_ValidEmail, it would be relatively easy to replicate now in CF8 or
above.

To replace CFX_ValidEmail, I'd look at performing an MX lookup on the domain
and then if you need to do an SMTP check, you'd have to implement a short
SMTP client that "pretends" to be sending an e-mail to the relevant server
and validates the inbound e-mail address against the mailboxes it looks
after.

In my POPCFC client on RIA forge, there's a "socket" class that makes
sending and receiving data over protocols like SMTP easy so it wouldn't take
more than a couple of hours to rig something up to replace CFX_ValidEmail
totally in a pure CF/Java way.

Paul




~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~|
Order the Adobe Coldfusion Anthology now!
http://www.amazon.com/Adobe-Coldfusion-Anthology/dp/1430272155/?tag=houseoffusion
Archive: http://www.houseoffusion.com/groups/cf-talk/message.cfm/messageid:356922

hofar...@houseoffusion.com

unread,
Oct 15, 2013, 11:49:22 AM10/15/13
to ColdFusion Technical Talk

>>To replace CFX_ValidEmail, I'd look at performing an MX lookup on the domain

Thanks for your feedback.
This is what I have implemented in my address validation function used by my forms.

>>and then if you need to do an SMTP check, you'd have to implement a short
SMTP client that "pretends" to be sending an e-mail to the relevant server
and validates the inbound e-mail address against the mailboxes it looks
after.

I'm not going this far, doing so, you have no waranty the the destination server will be ready to accept the mail,
then you have to check for answers like "server too busy, try latter" and so on.
What I need is a 100% sure impossible address detection, not a 100% good address detection.

Also, "pretending" to be sending an e-mail to the relevant server, and abort the communication before sending the data, is not a good idea if one intend to validate hundreds of addresses.
This mehod could be taken by the server as a spammer trick to purge his database.


~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~|
Order the Adobe Coldfusion Anthology now!
http://www.amazon.com/Adobe-Coldfusion-Anthology/dp/1430272155/?tag=houseoffusion
Archive: http://www.houseoffusion.com/groups/cf-talk/message.cfm/messageid:356924
Reply all
Reply to author
Forward
0 new messages