Add signature to emails

Add-in Express™ Support Service
That's what is more important than anything else

Add signature to emails
 
avenius




Posts: 2
Joined: 2011-12-02
Hello Support Team,

I will create an AddIn to add a signature (from file) to each new and reply emails.

I use for this "InspectorActivate" but this event fired two times...

What is the best way for?


Private Sub adxOutlookEvents_InspectorActivate(sender As System.Object, inspector As System.Object, folderName As System.String) Handles adxOutlookEvents.InspectorActivate
        Dim mailItem As Outlook.MailItem = TryCast(inspector.CurrentItem, Outlook.MailItem)

        
        Dim strTemplate As String
        strTemplate =LoadFile("c:PathSigTemplate.htm")
        If Trim(strTemplate) = "" Then
            Exit Sub
        End If


        Dim strBody As String
        Dim strOldBody As String = ""
        Dim strOldHTMLBody As String = ""

        strOldBody = mailItem.Body
        strOldHTMLBody = mailItem.HTMLBody

        If Not (mailItem Is Nothing) Then
            If mailItem.EntryID Is Nothing Then
               If mailItem.BodyFormat = Outlook.OlBodyFormat.olFormatPlain Then
                   mailItem.HTMLBody = strTemplate & "</BR></HR></BR>" & strOldHTMLBody
                   mailItem.BodyFormat = Outlook.OlBodyFormat.olFormatHTML
               ElseIf mailItem.BodyFormat = Outlook.OlBodyFormat.olFormatHTML Then
                  mailItem.HTMLBody = strTemplate & "</BR></HR></BR>" & strOldHTMLBody
               Else
                  strBody = strOldBody 
                  mailItem.Body = strBody
               End If
            End If
        End If
    End Sub


Thanks for help

Best regards
Gunter
Posted 02 Dec, 2011 04:02:42 Top
Andrei Smolin


Add-in Express team


Posts: 16306
Joined: 2006-05-11
Hello,

Try using the NewInspector event.

What Outlook version do you have?

I've just found how they use the ItemSend event to insert a signature, see Selecting Outlook 2007 signature on send.

Regards from Belarus (GMT+3),

Andrei Smolin
Add-in Express Team Leader
Posted 02 Dec, 2011 04:38:32 Top
GunterA




Posts: 2
Joined: 2011-12-02
Hello,

I want create this AddIn for Outlook 2003 to Outlook 2010.

I will check the NewInspector event.

Sorry for my bad english.

Thanks and best regards
Gunter
Posted 02 Dec, 2011 05:21:29 Top
Andrei Smolin


Add-in Express team


Posts: 16306
Joined: 2006-05-11
No problem :)

Regards from Belarus (GMT+3),

Andrei Smolin
Add-in Express Team Leader
Posted 02 Dec, 2011 05:36:41 Top