Outlook 自动清理我的换行符并搞砸了我的电子邮件格式

Outlook autocleaning my line breaks and screwing up my email format(Outlook 自动清理我的换行符并搞砸了我的电子邮件格式)
本文介绍了Outlook 自动清理我的换行符并搞砸了我的电子邮件格式的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

I'm sending an email using the dotnet framework. Here is the template that I'm using to create the message:

Date of Hire: %HireDate%
Annual Salary: %AnnualIncome%
Reason for Request: %ReasonForRequest%

Name of Voluntary Employee: %FirstName% %LastName%
Total Coverage Applied For:  %EECoverageAmount%
Guaranteed Coverage Portion: %GICoveragePortion%
Amount Subject to Medical Evident: %GIOverage%

When the messages is received in outlook, outlook tells me "Extra line breaks in this message were removed". And the message displays like this:

Date of Hire: 9/28/2001
Annual Salary: $100,000
Reason for Request: New Hire

Name of Voluntary Employee: Ronald Weasley Total Coverage Applied For:  $500,000 Guaranteed Coverage Portion: $300,000.00 Amount Subject to Medical Evident: $200,000

Note how Outlook incorrectly removes needed line breaks after the name, EECoverageAmount, etc...

It's important for the email recepients to get a correctly formatted email, and I have to assume that some of them use outlook 2003. I also can't assume they will know enough to shutoff the autoclean feature to get the message to format properly.

I have viewed these messages in other mail clients and they display correctly

some more information:

  • I am using UTF-8 BodyEncoding (msg.BodyEncoding = System.Text.Encoding.UTF8)
  • The msg.Body is being read from a UTF-8 encoded text file, and each line is terminated with a crlf.

Question: How do I change the format of the message to avoid this problem?

解决方案

Start every line with 2 spaces and outlook will be "tricked" into keeping your formatting.

So change

Date of Hire: %HireDate%
Annual Salary: %AnnualIncome%
Reason for Request: %ReasonForRequest%

Name of Voluntary Employee: %FirstName% %LastName%
Total Coverage Applied For:  %EECoverageAmount%
Guaranteed Coverage Portion: %GICoveragePortion%
Amount Subject to Medical Evident: %GIOverage%

to

  Date of Hire: %HireDate%
  Annual Salary: %AnnualIncome%
  Reason for Request: %ReasonForRequest%

  Name of Voluntary Employee: %FirstName% %LastName%
  Total Coverage Applied For:  %EECoverageAmount%
  Guaranteed Coverage Portion: %GICoveragePortion%
  Amount Subject to Medical Evident: %GIOverage%
^^ <--- Two extra spaces at the start of every line

Here is the article I found when researching this problem which goes into a little more depth than my answer.

这篇关于Outlook 自动清理我的换行符并搞砸了我的电子邮件格式的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持编程学习网!

本站部分内容来源互联网,如果有图片或者内容侵犯您的权益请联系我们删除!

相关文档推荐

c# Generic Setlt;Tgt; implementation to access objects by type(按类型访问对象的C#泛型集实现)
InvalidOperationException When using Context Injection in ASP.Net Core(在ASP.NET核心中使用上下文注入时发生InvalidOperationException)
quot;Overflowquot; compiler error with -9223372036854775808L(编译器错误-9223372036854775808L(Q;溢出Q))
Visual Studio 2010 ReportViewer Assembly References(Visual Studio 2010 ReportViewer程序集引用)
Weird behaviour when I open a reportviewer in WPF(在WPF中打开报表查看器时出现奇怪的行为)
how do i pass parameters to aspnet reportviewer(如何将参数传递给aspnet report查看器)