A Microsoft Outlook email forum. Outlook Banter

If this is your first visit, be sure to check out the FAQ by clicking the link above. You may have to register before you can post: click the register link above to proceed. To start viewing messages, select the forum that you want to visit from the selection below.

Go Back   Home » Outlook Banter forum » Microsoft Outlook Email Newsgroups » Outlook - Using Forms
Site Map Home Register Authors List Search Today's Posts Mark Forums Read Web Partners

Sign and Encrypt Emails on Custom Form



 
 
Thread Tools Search this Thread Display Modes
Prev Previous Post   Next Post Next
  #1  
Old June 26th 06, 04:48 PM posted to microsoft.public.outlook.program_forms
[email protected]
external usenet poster
 
Posts: 5
Default Sign and Encrypt Emails on Custom Form

Hi,

I have a custom Outlook 2003 form, Used for automatically checking the
Sign & Encrypt buttons on a standard email. This code works fine,
however when sending to someone who does not have a Microsoft Email
Client, they recieve any attachments as a winmail.dat file.

I have posted the code below:


================================================== =====
Option Explicit

Function Item_Send()
On Error Resume Next
Dim oDigSignCtl
Dim oCBs

Set oDigSignCtl = Item.GetInspector.CommandBars.FindControl(, 719)

If oDigSignCtl Is Nothing Then
' Add the toolbar button to the item.
Set oCBs = Item.GetInspector.CommandBars
Set oDigSignCtl = oCBs.Item("Standard").Controls.Add(,
719,,,True)
End If

' Check to make sure the button is not dimmed.
If oDigSignCtl.Enabled = True Then
' Check to make sure the button is not depressed.
If oDigSignCtl.State = 0 Then oDigSignCtl.Execute
Else
MsgBox "You do not have a digital signature! " & _
"This mail will not be sent."
' Cancel the send to only allow sending of signed mail.
Item_Send = False
Exit Function
End If

Set oCBs = Nothing
Set oDigSignCtl = Nothing
Set oDigSignCtl = Item.GetInspector.CommandBars.FindControl(, 718)

If oDigSignCtl Is Nothing Then
' Add the toolbar button to the item.
Set oCBs = Item.GetInspector.CommandBars
Set oDigSignCtl = oCBs.Item("Standard").Controls.Add(,
718,,,True)
End If

' Check to make sure the button is not dimmed.
If oDigSignCtl.Enabled = True Then
' Check to make sure the button is not depressed.
If oDigSignCtl.State = 0 Then oDigSignCtl.Execute
Else
MsgBox "You cannot encrypt this message! " & _
"This mail will not be sent."
' Cancel the send to only allow sending of signed mail.
Item_Send = False
Exit Function
End If

Set oCBs = Nothing
Set oDigSignCtl = Nothing


dim objFolder
Dim fldr
Dim i
Dim objNS
dim strFolderPath
dim aFolders
dim Copied

strFolderPath = Replace("Public Folders/All Public
Folders/Dispatch/Jobs Sent", "/", "\")
aFolders = Split("Public Folders\All Public Folders\Dispatch\Jobs
Sent", "\")

'get the Outlook objects
' use intrinsic Application object in form script
Set objNS = Application.GetNamespace("MAPI")

'set the root folder
Set fldr = objNS.Folders(aFolders(0))

'loop through the array to get the subfolder
'loop is skipped when there is only one element in the array
For i = 1 To UBound(aFolders)
Set fldr = fldr.Folders(aFolders(i))
'check for errors
If Err 0 Then Exit Function
Next
Set objFolder = fldr
'Item.Save
set Copied = item.copy
Copied.Move objFolder
Set objNS = Nothing
Set objFolder = Nothing
'msgbox("YOU HAVE GOT HERE")

If Err.number 0 Then
msgbox "An error occurred. Please contact IT Support."
Item_Send = false
Else

End If
End Function
================================================== =====

After much experientation, I have discovered that the following line is
causing the problems:
If oDigSignCtl.State = 0 Then oDigSignCtl.Execute
since if I comment out these lines, the email arrives correctly.

Is there another way to ensure that an email is sent encrypted? or a
workaround for this problem?

Many Thanks in advance,

Ben.

 




Thread Tools Search this Thread
Search this Thread:

Advanced Search
Display Modes

Posting Rules
You may not post new threads
You may not post replies
You may not post attachments
You may not edit your posts

vB code is On
Smilies are On
[IMG] code is On
HTML code is Off
Forum Jump

Similar Threads
Thread Thread Starter Forum Replies Last Post
Is it possible to open the default Contact form with the Activities tab activated from a custom form? VSTO 2005, Outlook 2003 David Webb Outlook and VBA 1 June 20th 06 09:59 PM
Emailing a contact vCard with custom form loses all custom info Kim Outlook - Using Contacts 7 April 27th 06 12:21 AM
How to access custom field in Custom Form by C# Minh Nguyen Outlook - Using Forms 3 April 24th 06 03:32 PM
I send an Outlook custom form, but a std. form displays? Sue Mosher [MVP-Outlook] Outlook - Using Forms 0 January 20th 06 07:41 PM
Cannot programmatically open custom message in custom form ms Outlook - Using Forms 1 January 20th 06 03:01 PM


All times are GMT +1. The time now is 11:09 AM.


Powered by vBulletin® Version 3.6.4
Copyright ©2000 - 2025, Jelsoft Enterprises Ltd.Search Engine Friendly URLs by vBSEO 2.4.0
Copyright ©2004-2025 Outlook Banter.
The comments are property of their posters.