Solved

SMTP Sink with VB.NET

Posted on 2004-08-08
14
891 Views
Last Modified: 2010-05-18
Can anyone please tell me how to implement an SMTP Sink using VB.NET. This was very easy in VB6 using the code below. I desperately need a working example to complete my Anti-Spam Engine. In VB6 I just set a Reference to the CDO For Windows 2000 and SEO, Use the code below and Register the Sink. I cannot work out how to do this in VB.NET. It is not as easy just using the exisiting COM Objects - I have tried.

Option Explicit

Implements CDO.ISMTPOnArrival
Implements IEventIsCacheable

Private Sub IEventIsCacheable_IsCacheable()
    ' Just returns S_OK.
End Sub

Private Sub ISMTPOnArrival_OnArrival(ByVal Msg As CDO.IMessage, EventStatus As CDO.CdoEventStatus)

    ' Process Message HERE

End Sub
0
Comment
Question by:BGillham
  • 6
  • 2
  • 2
14 Comments
 
LVL 37

Expert Comment

by:gregoryyoung
ID: 11749376
its a bit more complex ....

http://www.microsoft.com/downloads/details.aspx?FamilyId=0CD7F344-CAD6-416E-9BC1-0D7C214E1D0B&displaylang=en has the official MS examples.
http://www.codeproject.com/csharp/CsManagedEventSinksHooks.asp is an article on the subject using C# but should be very easily ported.
0
 
LVL 3

Author Comment

by:BGillham
ID: 11749414
I am fairly new to the .NET Platform and I have seen these examples. They are in C# and I do not know how to port these applications. I need a working sample in VB.NET.
0
 
LVL 3

Author Comment

by:BGillham
ID: 11756442
I will gladly give a 1000 points to get a solution to this question!
0
Free Tool: Path Explorer

An intuitive utility to help find the CSS path to UI elements on a webpage. These paths are used frequently in a variety of front-end development and QA automation tasks.

One of a set of tools we're offering as a way of saying thank you for being a part of the community.

 
LVL 37

Expert Comment

by:gregoryyoung
ID: 11756460
im looking for a predone one ... I work mainly in C# ... out of curiosity have you tried running a C#->VB.NET converter over the samples ?

0
 
LVL 3

Author Comment

by:BGillham
ID: 11756541
Been there, done that :-(
0
 
LVL 3

Expert Comment

by:Scoobyed
ID: 11762128
I've previosuly used some decent c# to vb.net just to see how to get some things going (albeit not on this smtp stuff)
http://authors.aspalliance.com/aldotnet/examples/translate.aspx
0
 
LVL 3

Author Comment

by:BGillham
ID: 11768379
I would also entertain a C# Solution that call a VB.NET Boolean Function that tells the Sink to either Abort or Deliver the Message.

EG:

If VBNET.Spam then
    Abort
else
    Deliver
End If

C# Code as I know it - I suck at this

if (VBAssembly.IsSpam==true)
{
    // Abort delivery of this message
}
else
{
    Delivery can proceed
{
0
 
LVL 3

Accepted Solution

by:
Scoobyed earned 500 total points
ID: 11781760
0
 
LVL 3

Author Comment

by:BGillham
ID: 12146759
Why is this question marked PAQ???????
Does "DarthMod" HONESTLY think that this question has been answered even in part?
While Scoobyed has made an honest attempt to answer the question he has added nothing new to what I already know. I KNOW how to do this in VB6. The question is VERY specific - Do it in DOTNET. If points are going to get awarded for these type of answers then take all my points because this Forum has become lame and I will not return. To prove my point take look at ALL my previously asked questions and with the exception of ONE they have ALL gone UNANSWERED. This Forum is NOT a good resource for serious programmers.
0
 
LVL 3

Author Comment

by:BGillham
ID: 12146961
What a lame response. The next person who has a similar request is going to pay good points for a NONE-ANSWER. I do not intend to be rude but this question should have deleted after 21 days NOT PAQed. It makes no difference to me because this site has been of no value to me whatsoever. There many other resources which have less red tape more technical know-how. This site may be great for beginners but it is of no value for developers with serious questions. I doubt if i will be back except if I am trying some new technology and need only beginner examples.
0

Featured Post

Free Tool: Subnet Calculator

The subnet calculator helps you design networks by taking an IP address and network mask and returning information such as network, broadcast address, and host range.

One of a set of tools we're offering as a way of saying thank you for being a part of the community.

Question has a verified solution.

If you are experiencing a similar issue, please ask a related question

This tutorial demonstrates one way to create an application that runs without any Forms but still has a GUI presence via an Icon in the System Tray. The magic lies in Inheriting from the ApplicationContext Class and passing that to Application.Ru…
A while ago, I was working on a Windows Forms application and I needed a special label control with reflection (glass) effect to show some titles in a stylish way. I've always enjoyed working with graphics, but it's never too clever to re-invent …
This video shows how to use Hyena, from SystemTools Software, to bulk import 100 user accounts from an external text file. View in 1080p for best video quality.
Finds all prime numbers in a range requested and places them in a public primes() array. I've demostrated a template size of 30 (2 * 3 * 5) but larger templates can be built such 210  (2 * 3 * 5 * 7) or 2310  (2 * 3 * 5 * 7 * 11). The larger templa…

831 members asked questions and received personalized solutions in the past 7 days.

Join the community of 500,000 technology professionals and ask your questions.

Join & Ask a Question