Outlook 2010 change signature based on recipient
Asked Answered
D

2

7

I was wondering if it was possible for when you enter a recipient's address for Outlook 2010 to automatically detect this address and change the signature accordingly? Just a general question.

Deliberate answered 20/2, 2014 at 8:32 Comment(0)
S
3

I've had the same question and so far have not found the answer. As a nice workaround, I've successfully used the solution provided here: https://superuser.com/a/228633/74819. In the end you get a button on the toolbar allowing you to create a new message with a custom To address and a pre-defined body text (including signature) of your choice.

Now I actually find this method nicer than what I was looking for because it is more predictable. If the signature (and thus the message body) was changing based on the list of recipients, you would loose control over your text. Also, with a tool of your own, you can set more than just a signature.

Story answered 30/4, 2014 at 13:0 Comment(0)
C
2

Are you looking for a setting to do this or are you willing to work with a macro? If you're open to working with macros, see below and reply back with questions.

Public WithEvents goInspectors As Outlook.Inspectors
Public WithEvents myMailItem As Outlook.MailItem

Private Sub Application_Startup()
    Initialize_Inspector
End Sub

Private Sub Initialize_Inspector()
    Set goInspectors = Outlook.Application.Inspectors
End Sub

Private Sub goInspectors_NewInspector(ByVal Inspector As Inspector)
    If Inspector.currentItem.Class = olMail Then
        Set myMailItem = Inspector.currentItem
    End If
End Sub

Private Sub myMailItem_PropertyChange(ByVal Name As String)

    'The variable below should be modified for your situation.
    'If you are in an Exchange environment, then you can use "last name, firstname"(caps-sensitive).
    'If the the recipient is not in Outlook's address list, use "[email protected]"
    customSignatureFor = "Lastname, Firstname"

    'Use vbCrLf to account for enter/returns
    oldSignature = "Respectfully," & vbCrLf & vbCrLf & "Phillip"
    newSignature = "v/r," & vbcrlf & "Phil"

    If Name = "To" Then
        For i = 1 To myMailItem.Recipients.count
            If InStr(myMailItem.Recipients(i), customSignatureFor) > 0 Then
                tempstring = Replace(myMailItem.Body, oldSignature, newSignature)
                myMailItem.Body = tempstring
            End If
        Next
    End If
    End Sub
Capreolate answered 21/2, 2014 at 6:27 Comment(6)
@Capreolate - thanks for this, but when I copy & paste this into a blank macro, I get an error message with the compiler - it says: "Only valid in object module" and the first two lines (ie public) are in red. Any idea what I'm doing wrong?Deliberate
Use this in the VBA environment. From Outlook, press Alt-F11 and paste this into thisOutlooksession. All should work from there.Capreolate
@Capreolate You have written (oldSignature = "Respectfully," & vbCrLf & vbCrLf & "Phillip"), but how would I account for a pre-made signature (eg one called 'standard') made in the standard signatures section of Outlook?Deliberate
Just recreate oldSignature to equal the text in your premade "standard" signature. If that doesn't make sense, post a screenshot of a blank email showing the signature, and I can help.Capreolate
@Capreolate - what if the 'standard' signature is an image rather than text? Would I then just refer to the location of the image instead?Deliberate
I've never dynamically switched signature images before, but this example shows how it can be done with some modification on your part for your specific situation. systemnetmail.com/faq/4.4.aspxCapreolate

© 2022 - 2024 — McMap. All rights reserved.