[AccessD] Access XP and MAPI

John Ruff papparuff at attbi.com
Mon Feb 24 13:39:00 CST 2003


Charlotte,
 
Here's code I use for Access2K and XP with Redemption.
 
Public Function SendEmail(strEmailAddr As String, _
                     Optional strAttachment As String) As Boolean
' Creator: John Ruff
' Date: 12/20/2002
' Email: papparuff at johnruff.com
' Call the function thus:
' SendEmail ("SendToEmailAddress at yahoo.com","c:\temp\Attch.txt
<mailto:SendToEmailAddress at yahoo.com> ")
 
On Error GoTo SendEmail_ERR
 
   Dim oApp As Object
   Dim oNameSpace As Object
   Dim SafeItem As Object
   Dim oItem As Object
 
   ' Create an instance of Outlook
   Set oApp = CreateObject("Outlook.Application")
   Set oNameSpace = oApp.NameSpace("MAPI")
   ' Create an instance of Redemption.SafeMailItem
   Set SafeItem = CreateObject("Redemption.SafeMailItem")
   ' Create a new message
   Set oItem = oApp.CreateItem(0)
 
   With SafeItem
      ' Set Item property
      .Item = oItem
      ' Set the Recipients property
      With .Recipients
         .Add strEmailAddr
         .ResolveAll
      End With
      ' Subject of Email
      .Subject = "Testing Redemption"
      ' Message body goes here
      .Body = "This is a test"
      ' If there is an attachment to be sent...
      If strAttachment <> "" Then
         ' Add the attachment to the email
         .Attachments.Add strAttachment
      End If
      ' Automatically send the Email
      .Send
   End With
 

   SendEmail = True
 
SendEmail_EXIT:
 
   On Error Resume Next
   ' Release all resources
   Set oItem = Nothing
   Set SafeItem = Nothing
   Set oApp = Nothing
 
   Exit Function
 
SendEmail_ERR:
 
   SendEmail = False
   MsgBox Err.Description
   Resume SendEmail_EXIT
 
End Function

 
 

John V. Ruff - The Eternal Optimist :-) 
Always Looking For Contract Opportunities 

 <http://www.noclassroom.com/> www.noclassroom.com 
Live software training 
Right over the Internet 

Home: 253.588.2139 
Cell: 253.307/2947 
9306 Farwest Dr SW 
Lakewood, WA 98498 

"Commit to the Lord whatever you do, 
        and your plans will succeed." Proverbs 16:3 

-----Original Message-----
From: accessd-admin at databaseadvisors.com
[mailto:accessd-admin at databaseadvisors.com] On Behalf Of Charlotte Foust
Sent: Monday, February 24, 2003 10:58 AM
To: AccessD at databaseadvisors.com
Subject: [AccessD] Access XP and MAPI



I'm trying to convert an A97 app to AXP where we've been using the
Redemption.dll to handle email and bypass the MAPI security stuff.  This
works fine in A97 even on a WinXP/Office XP machine.  However, the XP
conversion of the database chokes on 

Dim objSession As MAPI.Session 

Any suggestions?  I haven't tried late binding yet, but that's what I'll be
doing while I wait for enlightenment. <g> 

Charlotte Foust 

-------------- next part --------------
An HTML attachment was scrubbed...
URL: <http://databaseadvisors.com/pipermail/accessd/attachments/20030224/8bc98ebc/attachment-0001.html>


More information about the AccessD mailing list