Connecting Tech Pros Worldwide Help | Site Map

VB6 and Email capability

Salgoud Dell
Guest
 
Posts: n/a
#1: Jul 17 '05
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


Rowland
Guest
 
Posts: n/a
#2: Jul 17 '05

re: VB6 and Email capability



"Salgoud Dell" <nomail@cfu.net> wrote in message
news:chseav$1p6$1@news.cfu.net...[color=blue]
> 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
>[/color]
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.


M. Posseth
Guest
 
Posts: n/a
#3: Jul 17 '05

re: VB6 and Email capability



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" <nomail@cfu.net> wrote in message
news:chseav$1p6$1@news.cfu.net...[color=blue]
> 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
>
>[/color]


mayayana
Guest
 
Posts: n/a
#4: Jul 17 '05

re: VB6 and Email capability


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 <nomail@cfu.net> wrote in message
news:chseav$1p6$1@news.cfu.net...[color=blue]
> 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
>
>[/color]


JackFrost
Guest
 
Posts: n/a
#5: Jul 17 '05

re: VB6 and Email capability


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" <nomail@cfu.net> wrote in message
news:chseav$1p6$1@news.cfu.net...[color=blue]
> 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
>
>[/color]


Salgoud Dell
Guest
 
Posts: n/a
#6: Jul 17 '05

re: VB6 and Email capability


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" <nomail@cfu.net> wrote in message
news:chseav$1p6$1@news.cfu.net...[color=blue]
>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
>[/color]


Closed Thread