Review the following code using Redemptino. In addition, creating your
own certificate.
Sub Sendmailtest()
' This macro will send an email to an open contact
On Error GoTo Endlable
Dim ns As Outlook.NameSpace
Dim objFolder As Outlook.MAPIFolder
Dim Item As Object
Dim strContactInfo As String
Dim dataObject As MSForms.dataObject
' ------------------------------------------------------------------
' This portino of macro was created to obtain the email address from
the open contact
' ------------------------------------------------------------------
Set objApp = CreateObject("Outlook.Application")
Set objNS = objApp.GetNamespace("MAPI")
Set myOlApp = CreateObject("Outlook.Application")
Set myItem = myOlApp.ActiveInspector.CurrentItem
' Use redemption library to create safe mailitem
Dim SafeContact, oContact
Set SafeContact = CreateObject("Redemption.SafeContactItem") 'Create an
instance of Redemption.SafeContactItem
'Set oContact = Application.Session.GetDefaultFolder(10).Items(1) 'Get
a contact item from Outlook, can be any other contact
SafeContact.Item = myItem 'set Item property of a SafeContact to an
Outlook contact item
'SafeContact.Item = oContact 'set Item property of a SafeContact to an
Outlook contact item
If SafeContact.Email1Address <> "" Then
strContactInfo = SafeContact.Email1Address 'access Email1Address
property from SafeContact, no warnings are displayed
'MsgBox SafeContact.Email1Address
End If
' ------------------------------------------------------------------
' This portion of macro opens a new mail item
' ------------------------------------------------------------------
Dim SafeItem, oItem
Set SafeItem = CreateObject("Redemption.SafeMailItem") 'Create an
instance of Redemption.SafeMailItem
Set oItem = Application.CreateItem(0) 'Create a new message
SafeItem.Item = oItem 'set Item property
SafeItem.Recipients.Add (strContactInfo)
'SafeItem.Body = "Test Body"
SafeItem.Subject = "Test Subject"
SafeItem.Display
Endlable:
Set myNameSpace = Nothing
Set myFolder = Nothing
Set myItem = Nothing
Set SafeItem = Nothing
Set SafeContact = Nothing
End Sub