473,382 Members | 1,658 Online
Bytes | Software Development & Data Engineering Community
Post Job

Home Posts Topics Members FAQ

Join Bytes to post your question to a community of 473,382 software developers and data experts.

Microsoft SMTP Event Sink scripting.

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
5 1979
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
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
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
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
"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 thread has been closed and replies have been disabled. Please start a new discussion.

Similar topics

0
by: BlueMonkMN | last post by:
I've been trying to think of the right way to design relationships between objects with different desired lifetimes that raise events. If an event source is a relatively permanent object and the...
1
by: Bob Whiton | last post by:
I have an unmanaged class which has a member variable: gcroot<DataTable*> myDataTable; I would like to sink the RowDeleting event in my UNmanaged class. However, I can't declare an event...
0
by: Arnaud Debaene | last post by:
Hello all. I've got a bunch of existing, non managed, C++ DLLs that export types with, among other things, public events implemented using the boost::signals library. Now, I need to have...
0
by: techie | last post by:
I have created an event sink in my ATL COM project. The event sink receives events from a C# component. There is no problem with receving events but when my COM object is released I get an access...
6
by: Charles Law | last post by:
I have a class, which implements an interface. Let's say, that the interface looks something like Public Interface IEventSinks Sub ValueChanged(sender As Object, e As ValueChangedEventArgs) Sub...
6
by: utkarsh | last post by:
Hi All, I am using the following method "FireAsync" (i got the following information from the google groups) to fire the event for all the subscribers. Is there another way to fire the event...
9
by: Eric Kaplan | last post by:
I have a function that will download XML from internet and load XML data into database. The function will take 5 - 20 minutes to finish. I heard I should use event sink (event listener) when...
1
by: mooni | last post by:
Hi all, I am trying to create a class that will act as event sink to a COM object. Just to tell you the COM object is SoftUSBEndpoint which is part of Device Simulation Framework. Anyways its...
5
by: =?Utf-8?B?Q29kZVJhem9y?= | last post by:
I have an event sink which does some work to the software we use, according to the data contained within an email. This is all working hunky dory. What i want to know is whether it is possible to...
0
by: Faith0G | last post by:
I am starting a new it consulting business and it's been a while since I setup a new website. Is wordpress still the best web based software for hosting a 5 page website? The webpages will be...
0
isladogs
by: isladogs | last post by:
The next Access Europe User Group meeting will be on Wednesday 3 Apr 2024 starting at 18:00 UK time (6PM UTC+1) and finishing by 19:30 (7.30PM). In this session, we are pleased to welcome former...
0
by: ryjfgjl | last post by:
In our work, we often need to import Excel data into databases (such as MySQL, SQL Server, Oracle) for data analysis and processing. Usually, we use database tools like Navicat or the Excel import...
0
by: taylorcarr | last post by:
A Canon printer is a smart device known for being advanced, efficient, and reliable. It is designed for home, office, and hybrid workspace use and can also be used for a variety of purposes. However,...
0
by: ryjfgjl | last post by:
If we have dozens or hundreds of excel to import into the database, if we use the excel import function provided by database editors such as navicat, it will be extremely tedious and time-consuming...
0
by: ryjfgjl | last post by:
In our work, we often receive Excel tables with data in the same format. If we want to analyze these data, it can be difficult to analyze them because the data is spread across multiple Excel files...
0
by: emmanuelkatto | last post by:
Hi All, I am Emmanuel katto from Uganda. I want to ask what challenges you've faced while migrating a website to cloud. Please let me know. Thanks! Emmanuel
0
BarryA
by: BarryA | last post by:
What are the essential steps and strategies outlined in the Data Structures and Algorithms (DSA) roadmap for aspiring data scientists? How can individuals effectively utilize this roadmap to progress...
0
by: Hystou | last post by:
There are some requirements for setting up RAID: 1. The motherboard and BIOS support RAID configuration. 2. The motherboard has 2 or more available SATA protocol SSD/HDD slots (including MSATA, M.2...

By using Bytes.com and it's services, you agree to our Privacy Policy and Terms of Use.

To disable or enable advertisements and analytics tracking please visit the manage ads & tracking page.