PDA

View Full Version : Second send button on new message



lenrod
04-24-2012, 12:39 PM
I have been working on setting up a second send message button for outlook 2003. The user would click on new message in outlook and it would have a button next to the normal send button on the standard toolbar called send encrypted. the send encrypted button will add a string to the subject line which my email gateway will find and encrypt the message and send it on. I have the code written to send the message and the code written to create the button however I cannot get the vba created button to execute the vba to send the message. I am sure I am missing somethign silly I do appologize for my ignorace as this is my first try at this type of thing. thank you for any assistance.

Sub AddToolbarButton()
Dim objBar As Office.CommandBar
Dim objButton As Office.CommandBarButton

Set Item = Outlook.Application.ActiveInspector.CurrentItem
Set objBar = Outlook.Application.ActiveInspector.CommandBars("Standard")
Set objButton = objBar.Controls.Add(msoControlButton, , , before:=3)
With objButton
.Caption = "Send Encrypted"
.OnAction = "EncryptMail"
.TooltipText = "Send Encrypted Email"
.FaceID = 277
.Style = msoButtonIconAndCaption
.BeginGroup = True
End With

End Sub
Private Sub EncryptMail()
Set Item = Outlook.Application.ActiveInspector.CurrentItem
Item.Subject = "Encrypted Email Message: " & Item.Subject
Item.Send
End Sub

JP2112
05-07-2012, 12:53 PM
I'm pretty sure you cannot programmatically encrypt messages, what would prevent a virus or other malicious program from self-signing anything it wants?

In any case, you would be better off trying to use the Application_ItemSend event rather than trying to create your own Send button.

lenrod
05-08-2012, 10:25 AM
I am not actually encrypting the message with the button all the button does is add th string to subject field which the email gateway is set to look for and the email gateway intercepts the message and does the encryption.

JP2112
05-08-2012, 11:26 AM
Got it now, I missed that in your original post.