Skip to content

Emailing Attachments Using the Redemption Library

How to email attachments using the Redemption Library – and avoid the Object Model Guardian.

Mark Riddick wrote in response to Access Archon #114, Avoiding the Object Model Guardian with the Redemption Library, asking how he could email report snapshots using the Redemption Library (he used to do this with the SendObject method).  I prefer to create a new email message and add the attachment to it (rather than using SendObject, which is rather buggy).  See the “Send an Access Report” section of Access Archon #101 for details on this method.  To avoid the Object Model Guardian, you can create a SafeMailItem object to work with using the following code segment (modify as needed for your use):

Set omsg = gappOutlook.CreateItem(olMailItem)

Set msg = New Redemption.SafeMailItem

 

msg.Item = omsg

 

With msg

   .To = strToEMail

   .Subject = strMessageSubject

   .Body = strBody

   .Attachments.Add strSnapshotFile

   .Send

End With

The strSnapshotFile variable is set with the file name of the saved report snapshot.

Note:  Messages created with Redemption Library objects are created in the Drafts folder instead of the Outbox, but they will be sent as if from the Outbox.

About this author

Office 2024 - all you need to know. Facts & prices for the new Microsoft Office. Do you need it?

Microsoft Office upcoming support end date checklist.