Go Premium for a chance to win a PS4. Enter to Win

x
?
Solved

VB6 code to send Email

Posted on 2011-02-21
4
Medium Priority
?
279 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 2000 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

Keep up with what's happening at Experts Exchange!

Sign up to receive Decoded, a new monthly digest with product updates, feature release info, continuing education opportunities, and more.

Question has a verified solution.

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

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…
You can of course define an array to hold data that is of a particular type like an array of Strings to hold customer names or an array of Doubles to hold customer sales, but what do you do if you want to coordinate that data? This article describes…
As developers, we are not limited to the functions provided by the VBA language. In addition, we can call the functions that are part of the Windows operating system. These functions are part of the Windows API (Application Programming Interface). U…
Get people started with the process of using Access VBA to control Excel using automation, Microsoft Access can control other applications. An example is the ability to programmatically talk to Excel. Using automation, an Access application can laun…

886 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