I am writing VB6 for Email2DB script at my company and cannot seem to figure stuff out. I am new to VB6 I can do C# and its been a while since VB.net
Here is what I am looking to do.
I want to connect to my SQLEXPRESS server and run a query to see if something exists. Something like.
SELECT USERNAME FROM MFUSERS WHERE USERNAME= MSG.GetToAddr(i).
Then assign the result to a string
So Dim result as string = sql.response (not sure how to code this either)
Then am having my vb script check if the MSG.GetToAddr = the sql.response. If so it does something. If not it does something else.
Here is my code so far.
' Outbound Mail Server
' This script fires before emails are sent via the Email2DB Mail Server.
' Use it to implement custom accept/reject rules, or change/add headers or message text.
' Set the property Email2DBAccept to True to accept the message.
' The current message can be accessed via the MSG object.
' commands start here
Email2DBAccept = Email2DBAccept
Dim numto As Long
numto = MSG.NumTo
If (numto > 0) Then
For i = 0 To numto - 1
'This checks to see if the email exists in the DB if it does then it does not relay it.
'If it does not exists then it sends it normal and allows it to relay out.
If MSG.GetToAddr(i) ="firstname.lastname@example.org" Then
' This is the final end if below which has the starting of the If (numto) in the begining