Solved

VB6 code to send Email

Posted on 2011-02-21
4
275 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

On Demand Webinar - Networking for the Cloud Era

This webinar discusses:
-Common barriers companies experience when moving to the cloud
-How SD-WAN changes the way we look at networks
-Best practices customers should employ moving forward with cloud migration
-What happens behind the scenes of SteelConnect’s one-click button

Question has a verified solution.

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

Suggested Solutions

Introduction While answering a recent question about filtering a custom class collection, I realized that this could be accomplished with very little code by using the ScriptControl (SC) library.  This article will introduce you to the SC library a…
Most everyone who has done any programming in VB6 knows that you can do something in code like Debug.Print MyVar and that when the program runs from the IDE, the value of MyVar will be displayed in the Immediate Window. Less well known is Debug.Asse…
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…

685 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