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 Mike Lewis on being selected by the Tek-Tips community for having the most helpful posts in the forums last week. Way to Go!

how to do email from vb without using outlook express

Status
Not open for further replies.

andypower

Programmer
Aug 10, 2004
23
0
0
IN
hi myself avi
i m developing application in vb and i want to do email but i dont want to use outlook express and cdont,mapi control
so plz suggest me any idea to do this
thnx in advance
 
You could try using outlook object library. You may have issues with warnings coming up depending on your version of outlook.

Dim oOutlook As New Outlook.Application
Dim oMailitem As Outlook.MailItem
Dim oAttach As Outlook.Attachment

Set oMailitem = oOutlook.CreateItem(Outlook.OlItemType.olMailItem)
oMailitem.To = "someone@com.com"
oMailitem.Body = "Text."
oMailitem.Display
 
Code:
Set myMail=CreateObject("CDO.Message")
myMail.Subject="Sending email with CDO"
myMail.From="mymail@mydomain.com"
myMail.To="someone@somedomain.com"
myMail.TextBody="This is a message."
myMail.Configuration.Fields.Item _
("[URL unfurl="true"]http://schemas.microsoft.com/cdo/configuration/sendusing")=2[/URL]
'Name or IP of remote SMTP server
myMail.Configuration.Fields.Item _
("[URL unfurl="true"]http://schemas.microsoft.com/cdo/configuration/smtpserver")[/URL] _
="smtp.server.com"
'Server port
myMail.Configuration.Fields.Item _
("[URL unfurl="true"]http://schemas.microsoft.com/cdo/configuration/smtpserverport")[/URL] _
=25 
myMail.Configuration.Fields.Update
myMail.Send
set myMail=nothing
 
PaultheS

That method only works with recent versions of windows. If the OP sells the application to someone with NT 4 or windows 98 it won´t work.

Another good option from VB or VBA is VBSendMail.dll available at



Regards

Frederico Fonseca
SysSoft Integrated Ltd
 
Status
Not open for further replies.

Part and Inventory Search

Sponsor

Back
Top