[AccessD] EMail recommendations

Gustav Brock Gustav at cactus.dk
Mon Feb 15 10:05:46 CST 2010


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





More information about the AccessD mailing list