[AccessD] Outlook & Redemption

Andy Lacey andy at minstersystems.co.uk
Thu Mar 10 05:16:42 CST 2005


Paul

This should get you going. I've trimmed extra stuff (error handling, filling
arrays, etc) to keep it small. You'll work out those bits I'm sure. So this
is the bare bones. Don't forget the reference to the Outlook library will
you?

Function RedemptionSendMessage(blnDisplay As Boolean)

Dim astrTo() As String
Dim astrCC() As String
Dim astrBCC() As String
Dim astrAttach() As String
Dim intCounter As Integer
Dim strBody As String
Dim strSubject As String
Dim objOutlook As Outlook.Application
Dim objOutlookAttach As Outlook.Attachment
Dim objOutlookMsg As Outlook.MailItem

Dim objSafeMailItem As Object
Dim objRecipient As Object


'Create the Outlook session
Set objOutlook = CreateObject("Outlook.Application")
'Create the message
Set objOutlookMsg = objOutlook.CreateItem(olMailItem)
'Attachments
For intCounter = 1 To UBound(astrAttach)
Set objOutlookAttach = objOutlookMsg.Attachments.Add(astrAttach(intCounter))
Next
'Create Redemption object
Set objSafeMailItem = CreateObject("Redemption.SafeMailItem")
'Clone Outlook message as Redemption object
objSafeMailItem.Item = objOutlookMsg
'Add recipients, (To, CC and BCC)
With objSafeMailItem
For intCounter = 1 To UBound(astrTo)
Set objRecipient = .Recipients.Add(astrTo(intCounter))
objRecipient.Type = olTo
Next

For intCounter = 1 To UBound(astrCC)
Set objRecipient = .Recipients.Add(astrCC(intCounter))
objRecipient.Type = olCC
Next

For intCounter = 1 To UBound(astrBCC)
Set objRecipient = .Recipients.Add(astrBCC(intCounter))
objRecipient.Type = olBCC
Next

.Recipients.ResolveAll
'Subject and body
.Subject = strSubject
.Body = strBody
'Either display in Outlook or just send
If blnDisplay = True Then
.Display
Else
.Save
.Send
End If

End With

Set objRecipient = Nothing
Set objOutlookAttach = Nothing
Set objOutlookMsg = Nothing
Set objOutlook = Nothing
Set objSafeMailItem = Nothing

End Function

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



--------- Original Message --------
From: Access Developers discussion and problem solving
<accessd at databaseadvisors.com>
To: Access Developers discussion and problem solving
<accessd at databaseadvisors.com>
Subject: Re: Re: [AccessD] Outlook & Redemption
Date: 10/03/05 11:51

>
> Andy,
>
> Yes please, just code for sending an email with an attachment
>
> Thanks
>
> Paul
>
>
>
>
>
> Message date : Mar 10 2005, 11:42 AM
> >From : "Andy Lacey"
> To : "Access Developers discussion and problem solving"
> Copy to :
> Subject : Re: [AccessD] Outlook & Redemption
> Paul
> Yes. What do you want? Just code for sending an email?
>
> --
> Andy Lacey
> http://www.minstersystems.co.uk
>
>
>
> --------- Original Message --------
> From: Access Developers discussion and problem solving
>
> To: accessd
> Subject: [AccessD] Outlook & Redemption
> Date: 10/03/05 10:05
>
> >
> > To all,
> >
> > Has anyone any experience is using Outlook Redemption with Outlook
2000, I
> have never used this before so am looking for some easy to follow sample
> code, if anyone has any.
> >
> > Thanks in advance for all your help on this....
> >
> > Paul Hartland
> >
> > --
> >
> > Whatever you Wanadoo:
> > http://www.wanadoo.co.uk/time/
> >
> > This email has been checked for most known viruses - find out more
at:
> http://www.wanadoo.co.uk/help/id/7098.htm
> > --
> > AccessD mailing list
> > AccessD at databaseadvisors.com
> > http://databaseadvisors.com/mailman/listinfo/accessd
> > Website: http://www.databaseadvisors.com
> >
> >
> >
> >
> >
> >
>
> ________________________________________________
> Message sent using UebiMiau 2.7.2
>
> --
> AccessD mailing list
> AccessD at databaseadvisors.com
> http://databaseadvisors.com/mailman/listinfo/accessd
> Website: http://www.databaseadvisors.com
>
> --
>
> Whatever you Wanadoo:
> http://www.wanadoo.co.uk/time/
>
> This email has been checked for most known viruses - find out more at:
http://www.wanadoo.co.uk/help/id/7098.htm
> --
> AccessD mailing list
> AccessD at databaseadvisors.com
> http://databaseadvisors.com/mailman/listinfo/accessd
> Website: http://www.databaseadvisors.com
>
>
>
>
>
>

________________________________________________
Message sent using UebiMiau 2.7.2




More information about the AccessD mailing list