By using this site, you agree to our updated Privacy Policy and our Terms of Use. Manage your Cookies Settings.
424,969 Members | 1,536 Online
Bytes IT Community
+ Ask a Question
Need help? Post your question and get tips & solutions from a community of 424,969 IT Pros & Developers. It's quick & easy.

VB6 and Email capability

P: n/a
I have a project within which I need to send an automatically produced
report to a client list. Can anyone point me to documentation on
implimenting an email sending routine within a VB6 program? Code samples?

Thanks

Sal in Iowa
Jul 17 '05 #1
Share this Question
Share on Google+
5 Replies


P: n/a

"Salgoud Dell" <no****@cfu.net> wrote in message
news:ch**********@news.cfu.net...
I have a project within which I need to send an automatically produced
report to a client list. Can anyone point me to documentation on
implimenting an email sending routine within a VB6 program? Code samples?

Thanks

Sal in Iowa

Here's a function I used to use ages ago - I've since created a .NET
version, so I can't gaurantee that it ever worked (!), but it should give
you some pointers if it doesnt. It makes use of Microsoft's CDO library, so
you will prob. need that installed - I recommend reading up about it, and
CDONTS as well - a simple google search should yield loads of results.

**************** CODE ****************
Public Function fSendMailCDO(sTo As String, sFrom As String, sSubject As
String, sMessage As String) As Boolean
'Returns true if the message was sent, else return's false
'This function cannot guarantee the e-mail was recieved and/or read.
On Error GoTo errorHandler
Dim objConf As New CDO.Configuration
Dim objMessage As New CDO.Message
objConf.Fields.Item(cdoSendUsingMethod).value = 2
objConf.Fields.Item(cdoSMTPServer).value = "skinner"
objConf.Fields.Update

objMessage.Configuration = objConf
objMessage.From = sFrom
objMessage.To = sTo
objMessage.HTMLBody = sMessage
objMessage.Subject = sSubject
objMessage.Send

fSendMailCDO = True
Exit Function
errorHandler:
Select Case err.Number
Case -2147220977: 'E-mail address rejected
Debug.Print fGetErrorLogPrefix + vbCrLf + _
"ERROR: EMAIL ADDRESS REJECTED" + vbCrLf + _
err.Description + vbCrLf + vbCrLf
Case Else
Debug.Print fGetErrorLogPrefix + vbCrLf + _
"UNHANDLED EXCEPTION in fSendMail" + vbCrLf + _
CStr(err.Number) + vbCrLf + _
err.Description
End Select
fSendMailCDO = False
End Function
**************** END CODE ****************

HTH,

Rowland.
Jul 17 '05 #2

P: n/a

use the sendmail.dll from freevbcode

it is free , comes with source ( VB 6 code ) and is superior to most
commercial e-mail components
( can send html formatted mail , with embedded pictures , can send
atachments etc etc etc etc )

if you don`t like external dependancy`s it is even possible to include the
classes in your own project :-)

download it here :

http://www.freevbcode.com/ShowCode.Asp?ID=109
happy coding
M. Posseth [MCP]

"Salgoud Dell" <no****@cfu.net> wrote in message
news:ch**********@news.cfu.net...
I have a project within which I need to send an automatically produced
report to a client list. Can anyone point me to documentation on
implimenting an email sending routine within a VB6 program? Code samples?

Thanks

Sal in Iowa

Jul 17 '05 #3

P: n/a
http://www.jsware.net/jsware/vbcode.html

See the email User Control download. It has no
dependencies - no CDO, no Outlook, no Winsock OCX.
It's missing a few niceties like multiple recipients,
CC option, etc., but you can add those easily enough.

--
--
Salgoud Dell <no****@cfu.net> wrote in message
news:ch**********@news.cfu.net...
I have a project within which I need to send an automatically produced
report to a client list. Can anyone point me to documentation on
implimenting an email sending routine within a VB6 program? Code samples?

Thanks

Sal in Iowa

Jul 17 '05 #4

P: n/a
I use Ostrosofts OSSMTP control
(http://www.ostrosoft.com/smtp_component.asp)

It has all the niceties you might expect (CC,BCC, Attachments) and is free.
Works very nicely most of the time, but you might need to tweak your
security settings on some machines if they are particularly high.
I'm using this in a program that sends me an email everyday without fail.

JackFrost
"A day without sun is like night."
"Salgoud Dell" <no****@cfu.net> wrote in message
news:ch**********@news.cfu.net...
I have a project within which I need to send an automatically produced
report to a client list. Can anyone point me to documentation on
implimenting an email sending routine within a VB6 program? Code samples?

Thanks

Sal in Iowa

Jul 17 '05 #5

P: n/a
To all...
Thanks to all for the great tips. I now have my VB application sending out
automatic email reports, efficiently without drawing the wrath of my
anti-virus program. Your help was and always is greatly appreciated. I hope
I can return the favor.

Sal
"Salgoud Dell" <no****@cfu.net> wrote in message
news:ch**********@news.cfu.net...
I have a project within which I need to send an automatically produced
report to a client list. Can anyone point me to documentation on
implimenting an email sending routine within a VB6 program? Code samples?

Thanks

Sal in Iowa

Jul 17 '05 #6

This discussion thread is closed

Replies have been disabled for this discussion.