-
How to send email using SMTP
Posted on May 7th, 2009 2 commentsSending email using vb.net 2.0 framework is quite different from 1.1. The 1.1 framework is using a System.Web.Mail while 2.0 uses System.Net.Mail and it makes really different. There are some codes that are obsolete in 2.0 framework already that exist in 1.1 framework. In my case, since I am using vb.net 2.0 framework then I will share my code here that i used in my program that will send emails. I hope this will help to the people who are seeking codes that will send an email using vb.net 2.0 framework. As a default I am using gmail for my demo but it can be used to any email server as long as you know the configuration.
Set iMsg = CreateObject(”CDO.Message”)
Set iConf = CreateObject(”CDO.Configuration”)
Set Flds = iConf.Fieldsschema = “http://schemas.microsoft.com/cdo/configuration/”
Flds.Item(schema & “sendusing”) = 2
Flds.Item(schema & “smtpserver”) = “smtp.gmail.com”
Flds.Item(schema & “smtpserverport”) = 465
Flds.Item(schema & “smtpauthenticate”) = 1
Flds.Item(schema & “sendusername”) = “myemail@gmail.com”
Flds.Item(schema & “sendpassword”) = “mypassword”
Flds.Item(schema & “smtpusessl”) = 1
Flds.UpdateWith iMsg
.To = “admin@uiccs07.net”
.From = “admin@uiccs07.net>”
.Sender = “uiccs07.net”
.ReplyTo = “admin@uiccs07.net”
.Subject = “This is a subject”
.HTMLBody = “This is sample html email.”
.Organization = “uiccs07.net”
Set .Configuration = iConf
SendEmailGmail = .Send
End Withset iMsg = nothing
set iConf = nothing
set Flds = nothingLeave a reply














propecia June 7th, 2009 at 05:31