Tek-Tips is the largest IT community on the Internet today!

Members share and learn making Tek-Tips Forums the best source of peer-reviewed technical information on the Internet!

  • Congratulations SkipVought on being selected by the Tek-Tips community for having the most helpful posts in the forums last week. Way to Go!

send email through Visual Basic?

Status
Not open for further replies.

smcmanus

Technical User
Aug 1, 2001
25
0
0
CA
Writing a VB program and want to know if there is a way to send email. Maybe an active X. I have an exchange server.

Thanks for your response


Shannon
 
Goto your project references and check CDO or CDONTS . . . these libraries contain all that you will need for full email support from within VB. - Jeff Marler B-)
 
you can also use following code which uses CDO (Collaborating Data Objects)
Dim iMsg as New CDO.Message
Dim iConf as New CDO.Configuration

Dim Flds as ADODB.Fields
Set Flds = iConf.Fields

With Flds
.Item(cdoSendUsingMethod) = cdoSendUsingPort
.Item(cdoSMTPServerName) = "somehost@microsoft.com"
.Item(cdoSMTPConnectionTimeout) = 10 ' quick timeout
.Item(cdoSMTPAuthenticate) = cdoBasic
.Item(cdoSendUserName) = "username"
.Item(cdoSendPassword) = "password"
.Item(cdoURLProxyServer) = "server:80"
.Item(cdoURLProxyBypass) = &quot;<local>&quot;
.Item(cdoURLGetLatestVersion) = True
.Update
End With

With iMsg
Set .Configuration = iConf
.To = &quot;&quot;&quot;User A&quot;&quot; <userA@microsoft.com>&quot;
.From = &quot;&quot;&quot;User B&quot;&quot; <userB@microsoft.com>&quot;
.Subject = &quot;Hows it going? I've attached my web page&quot;
.CreateMHTMLBody &quot; .AddAttachment &quot;C:\files\mybook.doc&quot;
.Send
End With
 
Status
Not open for further replies.

Part and Inventory Search

Sponsor

Back
Top