Results 1 to 5 of 5
  1. #1
    Yann63 is offline Novice
    Windows 7 64bit Access 2010 64bit
    Join Date
    Dec 2012
    Posts
    13

    Sending HTML files via Access to Outlook

    Hey
    I wish to send out of MS Access mails via Outlook using HTML files.
    This went quite well using code underneath. But as soon as the HTML file contains images, these images doesn't appear in the mail body.

    Who can help me with this problem ?

    Thank you in advance !


    For Each objAccount In Outlook.Application.Session.Accounts
    If objAccount = ysender Then
    Set objOutlook = CreateObject("Outlook.Application")
    Set objOutlookMsg = objOutlook.CreateItem(olMailItem)
    xmessage = GetBoiler(xbodylocation)



    With objOutlookMsg
    Set objOutlookRecip = .Recipients.Add(xrecipient)
    objOutlookRecip.Type = olTo
    .SendUsingAccount = objAccount
    .subject = ysubject
    .DeferredDeliveryTime = Now() + TimeSerial(0, 3, 0)
    .BodyFormat = olFormatHTML
    .HTMLBody = xmessage
    If IsNull(Me![xreport]) Then
    Else
    Set objOutlookAttach = .Attachments.Add(xfilenaam)
    End If
    On Error Resume Next
    .Send
    End With
    End If
    Next

    Set objOutlookRecip = Nothing
    Set objOutlook = Nothing
    Set objOutlookMsg = Nothing

  2. #2
    June7's Avatar
    June7 is online now VIP
    Windows XP Access 2010 32bit
    Join Date
    May 2011
    Location
    The Great Land
    Posts
    52,929
    How to attach file: http://www.accessforums.net/showthread.php?t=70301 To provide db: copy, remove confidential data, run compact & repair, zip w/Windows Compression.

  3. #3
    trevor40's Avatar
    trevor40 is offline Advanced db Manager
    Windows XP Access 2003
    Join Date
    Feb 2014
    Location
    Australia
    Posts
    402
    thanks, but this is for vb6, I know it's similar but access doesnt have .AddInline as an option to do this.

    I tried

    myItem.HTMLBody = "<html><body>Hello, this is a embedded <img src=""cid:" & "c:\aaa\logo.bmp" & """ > picture.</body><html>"

    but only get an image place holder with an x on it.

  4. #4
    June7's Avatar
    June7 is online now VIP
    Windows 7 64bit Access 2010 32bit
    Join Date
    May 2011
    Location
    The Great Land
    Posts
    52,929
    What is cid:?

    This worked for me:

    .HTMLBody = "Hello, this is a embedded <img src='R:\Lab\Database\Program\Editing\LABDB.bmp'> picture."
    How to attach file: http://www.accessforums.net/showthread.php?t=70301 To provide db: copy, remove confidential data, run compact & repair, zip w/Windows Compression.

  5. #5
    Xipooo's Avatar
    Xipooo is offline Sr. Database Developer
    Windows 8 Access 2013
    Join Date
    Jan 2014
    Location
    Arizona
    Posts
    332
    Quote Originally Posted by June7 View Post
    What is cid:?

    This worked for me:

    .HTMLBody = "Hello, this is a embedded <img src='R:\Lab\Database\Program\Editing\LABDB.bmp'> picture."
    There may be some significance to using apostrophe as opposed to double quotation marks. Not sure if Outlook cares.

Please reply to this thread with any new information or opinions.

Similar Threads

  1. sending data into an email body - outlook
    By webisti in forum Access
    Replies: 6
    Last Post: 02-15-2012, 07:05 AM
  2. Sending Outlook E-mail - Run-time error '429'
    By jgelpi16 in forum Programming
    Replies: 2
    Last Post: 03-01-2011, 09:30 AM
  3. Replies: 3
    Last Post: 09-01-2010, 08:43 PM
  4. Import HTML files into access
    By mccrimmon in forum Programming
    Replies: 0
    Last Post: 02-15-2010, 03:40 PM
  5. Replies: 1
    Last Post: 03-09-2006, 01:50 PM

Posting Permissions

  • You may not post new threads
  • You may not post replies
  • You may not post attachments
  • You may not edit your posts
  •  
Other Forums: Microsoft Office Forums