Solved

VB6 code to send Email

Posted on 2011-02-21
4
273 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
ID: 34941009
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
ID: 34941017
0
 
LVL 70

Accepted Solution

by:
Éric Moreau earned 500 total points
ID: 34941842
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
ID: 34949139
Thanks a lot
0

Featured Post

Optimizing Cloud Backup for Low Bandwidth

With cloud storage prices going down a growing number of SMBs start to use it for backup storage. Unfortunately, business data volume rarely fits the average Internet speed. This article provides an overview of main Internet speed challenges and reveals backup best practices.

Question has a verified solution.

If you are experiencing a similar issue, please ask a related question

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…
When designing a form there are several BorderStyles to choose from, all of which can be classified as either 'Fixed' or 'Sizable' and I'd guess that 'Fixed Single' or one of the other fixed types is the most popular choice. I assume it's the most p…
Get people started with the process of using Access VBA to control Outlook using automation, Microsoft Access can control other applications. An example is the ability to programmatically talk to Microsoft Outlook. Using automation, an Access applic…
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…

770 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