Solved

SMTP Sink with VB.NET

Posted on 2004-08-08
14
928 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
Industry Leaders: We Want Your Opinion!

We value your feedback.

Take our survey and automatically be enter to win anyone of the following:
Yeti Cooler, Amazon eGift Card, and Movie eGift Card!

 
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

On Demand Webinar - Networking for the Cloud Era

This webinar discusses:
-Common barriers companies experience when moving to the cloud
-How SD-WAN changes the way we look at networks
-Best practices customers should employ moving forward with cloud migration
-What happens behind the scenes of SteelConnect’s one-click button

Question has a verified solution.

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

Suggested Solutions

Title # Comments Views Activity
VB.Net Tranfer data between to VB.Net apps 8 44
VB.NET 2008 Publish Error 2 43
Groupbox Control ? 2 27
VB.net Is there code behind PowerPivot 2 43
Well, all of us have seen the multiple EXCEL.EXE's in task manager that won't die even if you call the .close, .dispose methods. Try this method to kill any excels in memory. You can copy the kill function to create a check function and replace the …
I think the Typed DataTable and Typed DataSet are very good options when working with data, but I don't like auto-generated code. First, I create an Abstract Class for my DataTables Common Code.  This class Inherits from DataTable. Also, it can …
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.
Nobody understands Phishing better than an anti-spam company. That’s why we are providing Phishing Awareness Training to our customers. According to a report by Verizon, only 3% of targeted users report malicious emails to management. With compan…

685 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