Wrox Home  
Search P2P Archive for: Go

  Return to Index  

pro_vb thread: send mail using CDOSYS on Win 2000


Message #1 by "Meenal Kamath" <kamathm@n...> on Thu, 12 Dec 2002 19:25:09
I have created an ActiveX EXE component that connects to the CDOSYS library on Win 2000 to send out 
automated email messages. Following is a snippet of the code that connects to the CDOSYS library. The 
program seems to work but does not send out the messages to the concerned persons. This 
component references the Microsoft CDO for Exchange 2000 library since I do not have the cdosys.dll. 
Please let me know what needs to be changed here.

Dim iMsg As CDO.Message
Dim iConf As CDO.Configuration


Set iMsg = New CDO.Message
Set iConf = New CDO.Configuration

Do Until rsBirthdays.EOF
        mailname = rsBirthdays.Fields("Name").Value
        mailaddr = rsBirthdays.Fields("LotusIDNotes").Value
        mailfrom = "OPSSOLUT@n..."
        fulladdr = mailaddr & "@nationwide.com"
        mailbody = "Happy Birthday, "
        mailbody = mailbody & mailname & ","
        mailbody = mailbody & " from Operations Solutions!"
        mailbody = mailbody & vbCrLf & vbCrLf & "We have a card for you!!!" & vbCrLf & vbCrLf & "To 
view your card..." & vbCrLf & vbCrLf
        mailbody = mailbody & "Simply turn on your speakers" & vbCrLf & vbCrLf
        mailbody = mailbody & "and click on this link http://os.nwie.net/Birthday/BirthdayCard.asp" & 
vbCrLf & vbCrLf
        strBody = "Message sent on: " & Date & " at " & Time() & vbCrLf & vbCrLf
        strBody = strBody & mailbody
                 
        strBody = "Message sent on: " & Date & " at " & Time() & vbCrLf & vbCrLf
        strBody = strBody & mailbody
   With iMsg
        Set .Configuration = iConf
        .To = fulladdr
        .From = "OPSSOLUT@n..."
        .Subject = strBody
        .Send
    End With
    Call LogPrint(fulladdr)
    Debug.Print (fulladdr)
    Set cdoMail = Nothing
    SendMailAll = True
    rsBirthdays.MoveNext
Loop

Please can someone help me ?
Thanks
Meenal


  Return to Index