[AccessD] HTML Email from Access - Progress

Steve Capistrant scapistrant at symphonyinfo.com
Tue Aug 19 09:17:29 CDT 2003


MessageThank you, Andy.  You are right; I was trying to stuff the whole HTML
document into the HTMLBody, and it did include pictures, not just text with
picture references.

There seems to be two key variations to HTML email from Access, and I'm
going to experiment with both:

1) Using SendObject:  filling up the MessageText parameter by reading an
HTML file in line by line.  Pictures must be loaded on website because
SendObject doesn't allow creation of email attachments.  This has attraction
because I'm not limited to Outlook -- any MAPI compliant email application
will do.

2) Using Outlook Automation:  feeding the PicturePathAndFile into the
.Attachments property and the FileNameOnly into the .HTMLBody property.
The attraction here is slightly less work (you don't have to ftp your images
to your website), and the user's ability to view the email offline (locally
stored pictures).

I'll let you know how it goes.

Steve Capistrant
Symphony Information Services
scapistrant at symphonyinfo.com
Phone: 612-333-1311
www.symphonyinfo.com
212 3rd Ave N, Ste 404
Minneapolis, MN 55401

-----Original Message-----
From: accessd-bounces at databaseadvisors.com
[mailto:accessd-bounces at databaseadvisors.com]On Behalf Of Andy Lacey
Sent: Tuesday, August 19, 2003 3:14 AM
To: 'Access Developers discussion and problem solving'
Subject: RE: [AccessD] HTML Email from Access - Progress


Hi Steve
Well I never followed it through to an actual implementation, cos I didn't
need to. But when you say "the HTML document gets presented as an
attachment" do you mean a picture or the whole document. I certainly
generated an HTML email but pictures are a problem because the picture in
html is only a reference to a file. So the file has to be availble to the
recipient and, as I see it, there are two ways to do that. Firstly is to put
the pic(s) on a web site and make your html point to that. That works
beautifully and seems to be what's done on the advertising emails I get. The
second method is to send the pics along as attachments and point the html to
them. This is Brett's approach below. And it seems that if you strip all
path info from the picture's file reference then it defaults to pointing to
the attachment.

HTH. If you're trying the second method and it's not working post the code
and we'll try to help.
Andy Lacey
http://www.minstersystems.co.uk


  -----Original Message-----
  From: accessd-bounces at databaseadvisors.com
[mailto:accessd-bounces at databaseadvisors.com] On Behalf Of Steve Capistrant
  Sent: 19 August 2003 01:39
  To: Access Developers discussion and problem solving
  Subject: RE: [AccessD] HTML Email from Access - Progress


  Andy,

  Picked up this old horse.  I'm trying to repeat your success...getting
closer.....
  When I use Brett's code (see below), I have two problems.

  1) the HTML document gets presented as an attachment (rather than
displayed in the body).
  2) the email when received has the attachment stripped off.

  Are you doing something different than the code is it shows here?

  Thanks.

  Steve Capistrant
  Symphony Information Services
  scapistrant at symphonyinfo.com
  Phone: 612-333-1311
  www.symphonyinfo.com
  212 3rd Ave N, Ste 404
  Minneapolis, MN 55401

  -----Original Message-----
  From: accessd-bounces at databaseadvisors.com
[mailto:accessd-bounces at databaseadvisors.com]On Behalf Of Andy Lacey
  Sent: Wednesday, July 30, 2003 3:07 PM
  To: 'Access Developers discussion and problem solving'
  Subject: RE: [AccessD] HTML Email from Access - Progress


  Well I feel reasonably confident now going into my meeting on Saturday.
I've created an html email in Outlook from Access by reading an html page
knocked up in Frontpage. Just read it in line by line and built up a string.
I'm confident about Arthur's method of merging data from a contact database,
and pics (if required) would be bast stored on the web but could be sent as
per Brett's method. Kewl. And all in a day starting from having no idea.
This list rocks. Thanks everyone.

  Andy Lacey
  http://www.minstersystems.co.uk

    -----Original Message-----
    From: accessd-bounces at databaseadvisors.com
[mailto:accessd-bounces at databaseadvisors.com] On Behalf Of Brett Barabash
    Sent: 30 July 2003 20:43
    To: 'Access Developers discussion and problem solving'
    Subject: RE: [AccessD] HTML Email from Access - Progress


    Oops!  Let's try this again:

    Public Sub CreatePictureMail(ByVal strPicPath As String)

        Dim olItem As Outlook.MailItem
        Dim strFileName As String

        strFileName = Mid$(strPicPath, InStrRev(strPicPath,"\") + 1)

        Set olItem = Application.CreateItem(olMailItem)
        olItem.Attachments.Add strPicPath
        olItem.HTMLBody = "<html><img src=" & Chr$(34) & strFileName &
Chr$(34) & "></html>"
        olItem.Display

        Set olItem = Nothing

    End Sub

    The trick is that if you just supply the filename without a complete
path, the mail client should default to using the attachment directory path.
(I have only tried this in Outlook, so I would be very interested to hear if
it works in all clients).  I goofed up and included the entire path in my
original code.

    Also, you could certainly have a tag like:
    <IMG SRC="www.mydomain.com/images/pic1.jpg">

    This is probably a little more courteous, as it doesn't clog up the
recipient's mailbox.  Also, savvy email marketers (or relentless spammers)
have counters on their web servers to determine how many of the messages
actually get opened by counting the number of times the graphic is
downloaded.
-------------- next part --------------
An HTML attachment was scrubbed...
URL: <http://databaseadvisors.com/pipermail/accessd/attachments/20030819/c8d19fe1/attachment-0001.html>


More information about the AccessD mailing list