I recently asked to develop a small application using gmail's SMTP for sending email application.
I started with traditional winsock programming and found some issues with ssl and login procedures.
I tried with CDO and found working fine. Here is the portion of the code for your reference.
************* Code Starts Here ******************
VB 6.0 Code
Set iMsg = CreateObject("CDO.Message")
Set iConf = CreateObject("CDO.Configuration")
iConf.Load -1 ' CDO Source Defaults Set Flds = iConf.Fields
With Flds
.Item("http://schemas.microsoft.com/cdo/configuration/smtpusessl") = True
.Item("http://schemas.microsoft.com/cdo/configuration/smtpauthenticate") = 1
.Item("http://schemas.microsoft.com/cdo/configuration/sendusername") = "YOur gmail here"
.Item("http://schemas.microsoft.com/cdo/configuration/sendpassword") = "YOUR PASSWORD HERE"
.Item("http://schemas.microsoft.com/cdo/configuration/smtpserver") = "smtp.gmail.com"
.Item("http://schemas.microsoft.com/cdo/configuration/sendusing") = 2
.Item("http://schemas.microsoft.com/cdo/configuration/smtpserverport") = 25
.Update
End With
strbody = "Your Sample message "
With iMsg
Set .Configuration = iConf
.To = "
.CC = "
.BCC = ""
.Send
***********************Code Ends Here*****************************
Well, this works fine for me. BTW, how long microsoft would support the CDO?
No one knows , i guess.
Thank you, Readers.
JS
No comments:
Post a Comment