By using this site, you agree to our updated Privacy Policy and our Terms of Use. Manage your Cookies Settings.
440,742 Members | 773 Online
Bytes IT Community
+ Ask a Question
Need help? Post your question and get tips & solutions from a community of 440,742 IT Pros & Developers. It's quick & easy.

Microsoft SMTP Event Sink scripting.

P: n/a
I have a customer who has a virus/spam application that registers a couple
event sinks with SMTP to check for virus infected or spam email. Right now
all the email that meets the "bad" criteria gets relayed to a catchall mail
account. Any email that passes the tests gets relayed to the real SMTP
server. The problem is, the "bad" email includes email to nonexistant
accounts at the company.

What I am in need of is an event sink that does a directory lookup with each
email and if the user is not in the domain or active directory user list
then the mail should be sent back to the sender with the standard "relaying
not allowed" error.

Can anyone help me out with this? I think I understand the whole event sink
idea but I cannot find resources on doing the user lookup.

Thanks in advnace.

--
Sterling Anderson
sa*******@hbs.net


Nov 20 '05 #1
Share this Question
Share on Google+
5 Replies


P: n/a
Hi There,

Have you considered doing a simple directory query for each user? Here is
simple code I put togeather into a function in VB.NET togeather and this may
help ya:

Private Function FindListOwner(ByVal Name As String) As DirectoryEntry

'################################################# ##############

'# This will return the requested user using the email address

'################################################# ##############

Dim entry As New DirectoryEntry("LDAP://domain.com")

Dim mySearcher As New System.DirectoryServices.DirectorySearcher(entry)

Dim result As System.DirectoryServices.SearchResult

mySearcher.Filter = ("(&(Mail=" & Name &
"*)(objectClass=user)(objectCategory=person))" ) 'lookup a users rdn using
the begining of their email address

For Each result In mySearcher.FindAll()

Return result.GetDirectoryEntry

Next

End Function

If it doesnt find anything, then it doesnt exist.

-Timothy

"Sterling Anderson" <sa*******@nospam.hbs.net> wrote in message
news:eW*************@tk2msftngp13.phx.gbl...
I have a customer who has a virus/spam application that registers a couple
event sinks with SMTP to check for virus infected or spam email. Right now
all the email that meets the "bad" criteria gets relayed to a catchall mail account. Any email that passes the tests gets relayed to the real SMTP
server. The problem is, the "bad" email includes email to nonexistant
accounts at the company.

What I am in need of is an event sink that does a directory lookup with each email and if the user is not in the domain or active directory user list
then the mail should be sent back to the sender with the standard "relaying not allowed" error.

Can anyone help me out with this? I think I understand the whole event sink idea but I cannot find resources on doing the user lookup.

Thanks in advnace.

--
Sterling Anderson
sa*******@hbs.net

Nov 20 '05 #2

P: n/a
Have you considered upgrading to Exchange 2003? This is one of the new
features.

HTH
Deji
"Sterling Anderson" <sa*******@nospam.hbs.net> wrote in message
news:eW*************@tk2msftngp13.phx.gbl...
I have a customer who has a virus/spam application that registers a couple
event sinks with SMTP to check for virus infected or spam email. Right now
all the email that meets the "bad" criteria gets relayed to a catchall mail account. Any email that passes the tests gets relayed to the real SMTP
server. The problem is, the "bad" email includes email to nonexistant
accounts at the company.

What I am in need of is an event sink that does a directory lookup with each email and if the user is not in the domain or active directory user list
then the mail should be sent back to the sender with the standard "relaying not allowed" error.

Can anyone help me out with this? I think I understand the whole event sink idea but I cannot find resources on doing the user lookup.

Thanks in advnace.

--
Sterling Anderson
sa*******@hbs.net

Nov 20 '05 #3

P: n/a
Unfortunately upgrading is not an option. Also, the server that is doing the
filtering is just acting as an SMTP relay. So it is not interfacing with
Exchange at all.

"Deji Akomolafe akomolafe.com>" <deji@<removepadding> wrote in message
news:O1****************@TK2MSFTNGP09.phx.gbl...
Have you considered upgrading to Exchange 2003? This is one of the new
features.

HTH
Deji
"Sterling Anderson" <sa*******@nospam.hbs.net> wrote in message
news:eW*************@tk2msftngp13.phx.gbl...
I have a customer who has a virus/spam application that registers a couple event sinks with SMTP to check for virus infected or spam email. Right now all the email that meets the "bad" criteria gets relayed to a catchall

mail
account. Any email that passes the tests gets relayed to the real SMTP
server. The problem is, the "bad" email includes email to nonexistant
accounts at the company.

What I am in need of is an event sink that does a directory lookup with

each
email and if the user is not in the domain or active directory user list
then the mail should be sent back to the sender with the standard

"relaying
not allowed" error.

Can anyone help me out with this? I think I understand the whole event

sink
idea but I cannot find resources on doing the user lookup.

Thanks in advnace.

--
Sterling Anderson
sa*******@hbs.net


Nov 20 '05 #4

P: n/a
i believe there is an option in exchange 2000, i know there is in 2003 that
allows you to say, drop all mail that is destined to an address that doesn't
exist in your organization.

"Sterling Anderson" <sa*******@nospam.hbs.net> wrote in message
news:eW*************@tk2msftngp13.phx.gbl...
I have a customer who has a virus/spam application that registers a couple
event sinks with SMTP to check for virus infected or spam email. Right now
all the email that meets the "bad" criteria gets relayed to a catchall mail account. Any email that passes the tests gets relayed to the real SMTP
server. The problem is, the "bad" email includes email to nonexistant
accounts at the company.

What I am in need of is an event sink that does a directory lookup with each email and if the user is not in the domain or active directory user list
then the mail should be sent back to the sender with the standard "relaying not allowed" error.

Can anyone help me out with this? I think I understand the whole event sink idea but I cannot find resources on doing the user lookup.

Thanks in advnace.

--
Sterling Anderson
sa*******@hbs.net

Nov 20 '05 #5

P: n/a
"Sterling Anderson" <sa*******@nospam.hbs.net> wrote in message
news:eW*************@tk2msftngp13.phx.gbl...
I have a customer who has a virus/spam application that registers a couple
event sinks with SMTP to check for virus infected or spam email. Right now
all the email that meets the "bad" criteria gets relayed to a catchall mail account. Any email that passes the tests gets relayed to the real SMTP
server. The problem is, the "bad" email includes email to nonexistant
accounts at the company.

What I am in need of is an event sink that does a directory lookup with each email and if the user is not in the domain or active directory user list
then the mail should be sent back to the sender with the standard "relaying not allowed" error.

Can anyone help me out with this? I think I understand the whole event sink idea but I cannot find resources on doing the user lookup.

Thanks in advnace.

If you send me that script, I will convert it to that functionality and send
the improved version back, if possible. Anyway, the POP3 service that comes
with windows 20003 has the same effect so it should programatically, be
achieved in win2000 as well.
--
Sterling Anderson
sa*******@hbs.net


Nov 20 '05 #6

This discussion thread is closed

Replies have been disabled for this discussion.