'Getting signature from Outlook using python with Redemption RDO

I wrote a program that creates a mail in outlook and saves it in the .msg format. I want to add the signature of the user that is sending the mail (so the current account user) at the end of the HTMLBody. So far I haven't been able to find anything.

Any help would be appreciated. Here is an easy example of my code:

win32com.client.gencache.EnsureDispatch("Outlook.Application")
session = win32com.client.Dispatch("Redemption.RDOSession")
session.Logon("Outlook")
signatures = session.Signatures
msg = session.GetMessageFromMsgFile(r"test.msg")
msg.Subject = "test subject"
msg.HTMLBody ="<html><body> <b> this is a body</b></body></html>"
signatures.Item(1).ApplyTo(msg, False)
msg.SaveAs("file.msg")

It works now thanks for all the answers! :)



Solution 1:[1]

By defualt, you can find user's signatures stored in the following folder on the disk:

 C:\Users\%username%\AppData\Roaming\Microsoft\Signatures

It may contain the following files:

  • .htm - This file is used when creating HTML messages.
  • .rtf - This file is used when creating Rich Text messages.
  • .txt - This file is used when creating Plain Text message.

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

Basically you need to read an appropriate file on the disk and then instert the content to the mail item.

Sources

This article follows the attribution requirements of Stack Overflow and is licensed under CC BY-SA 3.0.

Source: Stack Overflow

Solution Source
Solution 1 Eugene Astafiev