Sending High Importance email through Outlook using Python
Question: Using win32com.client package, I'm able to send an HTML email using outlook
through Python. However, I'm having a hard time figuring out how to mark an
email "high priority" or "high importance".

Here is the code I'm using to successfully send out an email (with no priority
marking):

    
    
    RTFTEMPLATE = """<!DOCTYPE HTML PUBLIC "-//W3C//DTD HTML 3.2//EN">
    <HTML>
    <HEAD>
    <META HTTP-EQUIV=3D"Content-Type" CONTENT=3D"text/html; =
    charset=3Dus-ascii">
    <META NAME=3D"Generator" CONTENT=3D"MS Exchange Server version =
    08.00.0681.000">
    <TITLE>%s</TITLE>
    </HEAD>
    <BODY>
    <!-- Converted from text/rtf format -->
    
    <P DIR=3DLTR><SPAN LANG=3D"en-us"><FONT =
    FACE="Times New Roman">
    %s
    </FONT></SPAN><SPAN =
    LANG=3D"en-us"></SPAN></P>
    <br>
    %s
    </BODY>
    </HTML>"""
    
    Format = { 'UNSPECIFIED' : 0, 'PLAIN' : 1, 'HTML' : 2, 'RTF'  : 3}
    profile = "Outlook"
    
    
    #session = win32com.client.Dispatch("Mapi.Session")
    outlook = win32com.client.Dispatch("Outlook.Application")
    #session.Logon(profile)
    mainMsg = outlook.CreateItem(0)
    mainMsg.To = "RECIPIENT"
    mainMsg.Subject = subject
    mainMsg.BodyFormat = Format['RTF']
    mainMsg.HTMLBody = RTFTEMPLATE % (subject,html,bad_table)
    mainMsg.Send()
    


Answer: You are creating your message through the COM `Outlook Object Model`. This
model is fully documented, which can be a great help in situations like this.

For instance, the `MailItem` you are creating is documented
[here](http://msdn.microsoft.com/en-us/library/office/dn320330.aspx). As you
can tell from that page, it has a property
[Importance](http://msdn.microsoft.com/en-us/library/office/ff866759.aspx)
which you can set to 2 (olImportanceHigh) to mark the message as "high
importance".

In code

    
    
    mainMsg.Importance = 2
    

