Do you have to send code snippets or console window entries here and there via Outlook? For such code presentation or other special text markup, use the formatting templates.
Styles can also be useful in e-mails. However, these only work in Outlook if you have selected the HTML format for the e-mail format. Check this via file/options/e-mail. To compose a message in this format, select HTML and click OK. Now all text formatting is possible. Remember, however, that you do not use too exotic fonts, because otherwise the mails will not appear in the correct font for the recipient if your font is missing from him or her.
Are you ready? Then it can start. We show it using an Office 365 (version 2203 build 15028.20228) under Windows 11. It works similarly under other Outlook versions.
Solution: Open a new, empty mail in Outlook. In the Format Text tab, you can use Styles to create a style.
Here you create a style source: PCtipp.ch
In the dialog box, type a good name for the style. For my example, I use the designation Code block.
Enter a label and click Change Source: PCtipp.ch
Here you now have practically the same setting options as in Word. For my code block, I select the entry HTML Preformatted under “Style based on”. In addition, I activate the item Automatically update below as well as new documents based on this template. The interim result can already be seen in the preview.
There is already a suitable template for the code block, which you can choose from “based on” Source: PCtipp.ch
Now let’s go to Format below. Here, for example, you select Frames if you would like the new format in a frame. If desired, switch to Contour and choose a color for it. Switch to shading.
Grab a color under filling. Click OK. Under Format, you would have – if desired – further setting options. Above the preview window, there are optional alignment options such as centered or blockset, as well as options for line or paragraph spacing.
If necessary, set a frame and a shading Source: PCtipp.ch
Tip! If you really also make a code block, it is recommended to turn off the spell check in it. To do this, use the Language item via Format. Enable Do not check spelling and grammar.
Does the pattern look as intended in the preview? Click OK. Now you can mark a paragraph in your mails and select the code block from the styles – or whatever you have defined as your own format.