Solved

SMTP Sink with VB.NET

Posted on 2004-08-08
14
818 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
Comment Utility
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
Comment Utility
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
Comment Utility
I will gladly give a 1000 points to get a solution to this question!
0
 
LVL 37

Expert Comment

by:gregoryyoung
Comment Utility
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
Comment Utility
Been there, done that :-(
0
Threat Intelligence Starter Resources

Integrating threat intelligence can be challenging, and not all companies are ready. These resources can help you build awareness and prepare for defense.

 
LVL 3

Expert Comment

by:Scoobyed
Comment Utility
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
Comment Utility
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
Comment Utility
0
 
LVL 3

Author Comment

by:BGillham
Comment Utility
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
Comment Utility
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

Highfive + Dolby Voice = No More Audio Complaints!

Poor audio quality is one of the top reasons people don’t use video conferencing. Get the crispest, clearest audio powered by Dolby Voice in every meeting. Highfive and Dolby Voice deliver the best video conferencing and audio experience for every meeting and every room.

Join & Write a Comment

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 …
Microsoft Reports are based on a report definition, which is an XML file that describes data and layout for the report, with a different extension. You can create a client-side report definition language (*.rdlc) file with Visual Studio, and build g…
In this tutorial you'll learn about bandwidth monitoring with flows and packet sniffing with our network monitoring solution PRTG Network Monitor (https://www.paessler.com/prtg). If you're interested in additional methods for monitoring bandwidt…
You have products, that come in variants and want to set different prices for them? Watch this micro tutorial that describes how to configure prices for Magento super attributes. Assigning simple products to configurable: We assigned simple products…

762 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

Need Help in Real-Time?

Connect with top rated Experts

9 Experts available now in Live!

Get 1:1 Help Now