Solved

VB6 code to send Email

Posted on 2011-02-21
4
271 Views
Last Modified: 2012-05-11
Hi,

I need to send email in vb application using SMTP or TCPIP, can anybody tell me how to do that.

Thanks
Rajeeva
 
0
Comment
Question by:rajeeva_nagaraj
  • 2
4 Comments
 
LVL 8

Expert Comment

by:jimsweb
Comment Utility
We can utilize the vbSendMail.dll for this purpose.
'Module Level Declaration (WithEvents optional but recommended)
Private WithEvents poSendMail as vbSendMail.clsSendMail
Private Sub cmdSend_Click()
'Assumes you have a form with text boxes
set poSendMail = new vbSendMail.clsSendMail
poSendMail.SMTPHost = txtServer.Text
poSendMail.From = txtFrom.Text
poSendMail.FromDisplayName = txtFromName.Text
poSendMail.Recipient = txtTo.Text
poSendMail.RecipientDisplayName = txtToName.Text
poSendMail.ReplyToAddress = txtFrom.Text
poSendMail.Subject = txtSubject.Text
poSendMail.Attachment = txtFileName.text 'attached file name
poSendMail.Message = txtMsg.Text
poSendMail.Send
set poSendMail = nothing
End Sub

Open in new window

0
 
LVL 8

Expert Comment

by:jimsweb
Comment Utility
0
 
LVL 69

Accepted Solution

by:
Éric Moreau earned 500 total points
Comment Utility
vbSendMail (as told by jimsweb) is available from http://www.freevbcode.com/ShowCode.Asp?ID=109

I would also go with this free component. It was the one I was using in my VB6 days.
0
 

Author Closing Comment

by:rajeeva_nagaraj
Comment Utility
Thanks a lot
0

Featured Post

Better Security Awareness With Threat Intelligence

See how one of the leading financial services organizations uses Recorded Future as part of a holistic threat intelligence program to promote security awareness and proactively and efficiently identify threats.

Join & Write a Comment

I’ve seen a number of people looking for examples of how to access web services from VB6.  I’ve been using a test harness I built in VB6 (using many resources I found online) that I use for small projects to work out how to communicate with web serv…
Since upgrading to Office 2013 or higher installing the Smart Indenter addin will fail. This article will explain how to install it so it will work regardless of the Office version installed.
Get people started with the utilization of class modules. Class modules can be a powerful tool in Microsoft Access. They allow you to create self-contained objects that encapsulate functionality. They can easily hide the complexity of a process from…
Show developers how to use a criteria form to limit the data that appears on an Access report. It is a common requirement that users can specify the criteria for a report at runtime. The easiest way to accomplish this is using a criteria form that a…

763 members asked questions and received personalized solutions in the past 7 days.

Join the community of 500,000 technology professionals and ask your questions.

Join & Ask a Question

Need Help in Real-Time?

Connect with top rated Experts

14 Experts available now in Live!

Get 1:1 Help Now