locked
Removing the email signature RRS feed

  • Question

  • I have an email helpdesk system that receives emails, but when people send an email to that email address.

    I need it to remove the email signature, is there a simple way of achieving this with VBA?

    Monday, November 30, 2015 3:16 PM

Answers

  • Hello Darren,

    Users may prefer composing items in plain text. In that case the suggested way of searching bookmarks will fail. You need to know the signature content and search it in the body.

    By default you can find the Signatures folder in the following location;

    • Windows XP
      C:\Documents and Settings\%username%\Application Data\Microsoft\Signatures
    • Windows 8, Windows 7 and Windows Vista
      C:\Users\%username%\AppData\Roaming\Microsoft\Signatures

     Look for the following files and folders;

    • <signature_name>.htm
      This file is used when creating HTML messages.
    • <signature_name>.rtf
      This file is used when creating Rich Text messages.
    • <signature_name>.txt
      This file is used when creating Plain Text message.
    • <signature_name>_files

    This folder is used in Outlook to store supporting files for your signature such as formatting, images and/or business cards (vcf-files).

    So, you can check the folder for a corresponding signature file, read the file content and try to find such text in the message body depending on the BodyFormat used.

    The Outlook object model provides three main ways for working with item bodies:

    1. Body - a string representing the clear-text body of the Outlook item.
    2. HTMLBody - a string representing the HTML body of the specified item.
    3. Word editor - the Microsoft Word Document Object Model of the message being displayed. The WordEditor property of the Inspector class returns an instance of the Document class from the Word object model which you can use to set up the message body.

    You can read more about all these ways in the Chapter 17: Working with Item Bodies. It us up to you which way is to choose to customize the signature in the message body.

    Monday, November 30, 2015 6:50 PM

All replies

  • You can't effectively remove it unless you know the exact text (or a reliable pattern) you need to remove.  When you are composing an email in Outlook a hidden bookmark is created to mark the beginning of the signature block:

    <a name="_MailAutoSig">

    However that tag is removed after it is sent.


    Eric Legault (MVP: Outlook)
    Co-author, Microsoft Office 2013 Professional Step-By-Step

    Monday, November 30, 2015 3:31 PM
  • What about using Exchange to do this could that be possible?

    Regards

    Darren

    Monday, November 30, 2015 4:22 PM
  • The type of email account doesn't make a difference.  The challenge is in the structure - or lack of - in the HTML content.  It's strictly a text parsing issue.

    Eric Legault (MVP: Outlook)
    Co-author, Microsoft Office 2013 Professional Step-By-Step

    Monday, November 30, 2015 4:33 PM
  • Ok, so what are my options. I am thinking that it's going to be hard to achieve.

    Monday, November 30, 2015 4:35 PM
  • Your only option is to figure out if there's consistency to the structure of the HTML content - and I'm fairly confident this is nearly impossible.

    Imagine a simple email with only this content:

    --
    Eric Legault

    The HTML would be similar to this:

    <body lang=EN-CA link="#0563C1" vlink="#954F72"><div lang=EN-US style='font-size:10.0pt;font-family:"Segoe UI",sans-serif;color:#C0504D;--<o:p></o:p></span></p><p lang=EN-US style='font-size:10.0pt;font-family:"Segoe UI",sans-serif;color:#C0504D;Eric Legault<o:p></o:p></span></p><p>

    There's no static content to determine when the signature begins or ends. The <span> tag that precedes the double-dash cannot be differentiated from any other <span> tag that could have non-signature content. Same problem with the enclosing <P> tag, even though it's defined class is 'MsoNormal' - that's not an uncommon element for any email content.

    Your only hope of control is having access to ALL of the source signature files used by the sender - and that is surely impossible.  Sorry!


    Eric Legault (MVP: Outlook)
    Co-author, Microsoft Office 2013 Professional Step-By-Step

    Monday, November 30, 2015 5:06 PM
  • Well thanks for the assistance, I thought I would be stumped.

    Darren

    Monday, November 30, 2015 5:07 PM
  • Hello Darren,

    Users may prefer composing items in plain text. In that case the suggested way of searching bookmarks will fail. You need to know the signature content and search it in the body.

    By default you can find the Signatures folder in the following location;

    • Windows XP
      C:\Documents and Settings\%username%\Application Data\Microsoft\Signatures
    • Windows 8, Windows 7 and Windows Vista
      C:\Users\%username%\AppData\Roaming\Microsoft\Signatures

     Look for the following files and folders;

    • <signature_name>.htm
      This file is used when creating HTML messages.
    • <signature_name>.rtf
      This file is used when creating Rich Text messages.
    • <signature_name>.txt
      This file is used when creating Plain Text message.
    • <signature_name>_files

    This folder is used in Outlook to store supporting files for your signature such as formatting, images and/or business cards (vcf-files).

    So, you can check the folder for a corresponding signature file, read the file content and try to find such text in the message body depending on the BodyFormat used.

    The Outlook object model provides three main ways for working with item bodies:

    1. Body - a string representing the clear-text body of the Outlook item.
    2. HTMLBody - a string representing the HTML body of the specified item.
    3. Word editor - the Microsoft Word Document Object Model of the message being displayed. The WordEditor property of the Inspector class returns an instance of the Document class from the Word object model which you can use to set up the message body.

    You can read more about all these ways in the Chapter 17: Working with Item Bodies. It us up to you which way is to choose to customize the signature in the message body.

    Monday, November 30, 2015 6:50 PM