outlookoutlook-2007

How should I use Outlook to send code snippets?


As a programmer at a big corporation, I frequently send Outlook emails that contain code samples.

I'll actually type code directly into an email. This inevitably causes problems, as Outlook really likes to format text in pleasing but unhelpful ways. My code needs to be copyable out of the email and directly into code, so I don't want Outlook to mess with it by adding special characters or whatnot.

So I always need to tweak options like:

I also like my code to be in a monospaced font, black, indented, and smaller than other text. I've tried to make a Style for this, but for some reason the Style never saves. :-( [edit: turns out I wasn't telling it to work on "new documents based on this template"]

Is there some way to put code in <pre> blocks or something that tells Outlook to ignore all these rules and format code the way I want it to? If not, what ways have you found to send code snippets in Outlook emails without it getting super annoying?


Solution

  • If you are using Outlook 2010, you can define your own style and select your formatting you want, in the Format options there is one option for Language, here you can specify the language and specify whether you want spell checker to ignore the text with this style.

    With this style you can now paste the code as text and select your new style. Outlook will not correct the text and will not perform the spell check on it.

    Below is the summary of the style I have defined for emailing the code snippets.

    Do not check spelling or grammar, Border:
    Box: (Single solid line, Orange,  0.5 pt Line width)
    Pattern: Clear (Custom Color(RGB(253,253,217))), Style: Linked, Automatically update, Quick Style
    Based on: HTML Preformatted