Send E-Mail without useing a service that has to store those e-mail addresses

I am currently using MS Exchange to send e-mails automaticly in a VB app, The draw back is that I have to add every address to exchange so that i can send the mail. I am looking for a way to send mail without haveing to store the e-mail address in a location other than my database.

Thanks for your help,
Kevin
LVL 1
icserveAsked:
Who is Participating?
I wear a lot of hats...

"The solutions and answers provided on Experts Exchange have been extremely helpful to me over the last few years. I wear a lot of hats - Developer, Database Administrator, Help Desk, etc., so I know a lot of things but not a lot about one thing. Experts Exchange gives me answers from people who do know a lot about one thing, in a easy to use platform." -Todd S.

vinnyd79Commented:
What method are you using to send the e-mail?
0
Éric MoreauSenior .Net ConsultantCommented:
Hi icserve,

try this component: http://www.freevbcode.com/ShowCode.Asp?ID=109       

Cheers!
0
icserveAuthor Commented:
Public Function SendSMTP(SMTP_Server$, MailFrom$, From$, Addresses$, Subject$, Body$, Attachment$, Messages$) As Boolean
    On Error Resume Next
    SMTPMessages = ""
    ChDrive App.Path
    ChDir App.Path
    Err.Clear
    SetPrintFunc FnPtr(AddressOf PrintBlat)
    If Err Then
        MsgBox "Can't load BLAT.DLL"
        Exit Function
    End If
    Dim argv As StringArray
    argv.STRINGS(0) = "blat.dll"
    argv.STRINGS(1) = "-"
    argv.STRINGS(2) = "-server"
    argv.STRINGS(3) = SMTP_Server
    argv.STRINGS(4) = "-mailfrom"
    argv.STRINGS(5) = MailFrom
    If Len(Addresses) Then
        argv.STRINGS(6) = "-To"
        argv.STRINGS(7) = Addresses
    Else
        Messages = "No recipients."
        Exit Function
    End If
    argv.STRINGS(8) = "-s"
    argv.STRINGS(9) = Subject
    argv.STRINGS(10) = "-body"
    argv.STRINGS(11) = Body
    argv.STRINGS(12) = "-from"
    argv.STRINGS(13) = From
    argv.STRINGS(14) = "-mime" ' "-html" '"-enriched" '"-mime"
    argv.STRINGS(15) = "-binary"
    argv.STRINGS(16) = "-attach"
    argv.STRINGS(17) = Attachment
   
    Dim ret&
    Err.Clear
    ret = Blat(18, argv)
    If ret Or Err Then
        Messages = SMTPMessages + vbCrLf + "Sending e-mail via SMTP (BLAT.DLL) failed: " + CStr(ret)
        Exit Function
    End If
    SendSMTP = True
    Messages = SMTPMessages
End Function
0
Ultimate Tool Kit for Technology Solution Provider

Broken down into practical pointers and step-by-step instructions, the IT Service Excellence Tool Kit delivers expert advice for technology solution providers. Get your free copy now.

vinnyd79Commented:
It looks like the above is calling the Blat function to send the mail. Why can't you just read the records from your database and pass them to the SendSMTP function?
0
David LeeCommented:
Hi icserve,

> I have to add every address to exchange so that i can send the mail
Are you talking about the address of the sender or of the intended recipient?  If the latter, then I don't follow why.  I send messages to addresses that aren't in Exchange all the time via VB.

Cheers!
0
mah8473Commented:
you can achieve this with CDO (Collaboration Data object)

have a look here www.cdolive.com

But here's a pretty basic sample of code

'use CDO to send emails silently....**N.B-will not go to users sentItems**
Public Function bSendEmail(ByVal sEmail As String, ByVal sSubject As String, ByVal sBody As String, _
            Optional ByVal sPathFileName As String, Optional sFrom As String) As Boolean
   
Dim objMessage As New CDO.Message
    Dim iConf As CDO.Configuration

On Error GoTo Err_bSendEmail
           
    With objMessage    
        Set iConf = objMessage.Configuration
        'Set the fields of the configuration object to send using SMTP via port 25.
        With iConf.Fields
            .Item("http://schemas.microsoft.com/cdo/configuration/sendusing") = cdoSendUsingPort
            .Item("http://schemas.microsoft.com/cdo/configuration/smtpserver") = mySTMPServer
            .Item("http://schemas.microsoft.com/cdo/configuration/smtpserverport") = 25 'mail port
            .Item("http://schemas.microsoft.com/cdo/configuration/smtpauthenticate") = cdoAnonymous
            .Update
        End With
       
        .To = sEmail
        .From = sFrom
        .Subject = sSubject
        .TextBody = sBody
        .send
    End With
   
    bSendEmail = True

Err_bSendEmail:
    If Err.Number <> 0 Then
         MsgBox Err.Description, , Err.Source
         bSendEmail = False
    End If
   
    Set objMessage = Nothing
    Set objFSO = Nothing
   
End Function
0

Experts Exchange Solution brought to you by

Your issues matter to us.

Facing a tech roadblock? Get the help and guidance you need from experienced professionals who care. Ask your question anytime, anywhere, with no hassle.

Start your 7-day free trial
It's more than this solution.Get answers and train to solve all your tech problems - anytime, anywhere.Try it for free Edge Out The Competitionfor your dream job with proven skills and certifications.Get started today Stand Outas the employee with proven skills.Start learning today for free Move Your Career Forwardwith certification training in the latest technologies.Start your trial today
Visual Basic Classic

From novice to tech pro — start learning today.

Question has a verified solution.

Are you are experiencing a similar issue? Get a personalized answer when you ask a related question.

Have a better answer? Share it in a comment.