Jim Dettman
jimdettman at verizon.net
Mon Feb 15 10:46:59 CST 2010
Only gotcha is that there are subtle difference in the CDO libs (there is
more then one in use), although I believe most of that was with earlier OS's
(NT4).
Jim.
-----Original Message-----
From: accessd-bounces at databaseadvisors.com
[mailto:accessd-bounces at databaseadvisors.com] On Behalf Of Gustav Brock
Sent: Monday, February 15, 2010 11:06 AM
To: accessd at databaseadvisors.com
Subject: Re: [AccessD] EMail recommendations
Hi Tony
If you don't want to install anything, I can recommend using the native
Windows CDO component which is installed by default on any newer Windows.
Code is a bit long-winded but very flexible. Also, it can mail to either an
in-house Exchange server directly or to a normal SMTP server.
Here's an example that via SMTP emails one attachment - more can be added
quite easily:
<code>
Dim msg As New CDO.Message
With msg
With .Fields
' Custom X-Mailer info.
.Item(cdoXMailer) = "My Mailer V2.0"
.Update
End With
With .Configuration.Fields
.Item(cdoSMTPAuthenticate) = cdoAnonymous 'cdoBasic
' .Item(cdoSendUserName) = "myusername"
' .Item(cdoSendPassword) = "mypassword"
.Item(cdoSendUsingMethod) = cdoSendUsingPort
.Item(cdoSMTPServer) = "smtp.yourisp.com"
.Item(cdoSMTPConnectionTimeout) = 10
.Item(cdoSMTPServerPort) = 25
.Update
End With
.Organization = "myorganisation.org"
.To = "receiver at example.com"
.Subject = "Example to Example with attachment"
.TextBody = "Here you are!"
.From = "me at mydomain.com"
.AddAttachment ("c:\temp\report.pdf")
.Send
End With
Set msg = Nothing
</code>
And the CDO component is very fast - at zero cost.
/gustav
>>> iggy at nanaimo.ark.com 14-02-2010 17:39 >>>
Hey All
I have spent the last couple of days looking all kinds of code for
EMailing (COD, STMP etc.) and third party products, (Blat etc. currently
looking at Total Access EMailer). Does anyone have any suggestions on
what route to go, to send EMails with attachments from an Access
application. I do not want to muck around on the user's machine
(basically stay away from their registry, no other installs other than
the Access application). Basically a no brainer for the user (enter your
user ID but no enter your STMP server address/ID etc.). Orrrrrrrr.....I
am totally off base on this one and there is no easy simple solution.
Thanks
--
AccessD mailing list
AccessD at databaseadvisors.com
http://databaseadvisors.com/mailman/listinfo/accessd
Website: http://www.databaseadvisors.com