Outlook에서 내 줄 자동 정리 및 전자 메일 형식 강화
dotnet 프레임 워크를 사용하여 이메일을 보내고 있습니다. 메시지를 작성하는 데 사용하는 템플리트는 다음과 같습니다.
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%
메시지가 Outlook에서 수신되면 Outlook은 "이 메시지의 추가 줄 바꿈이 제거되었습니다"라고 알려줍니다. 메시지는 다음과 같이 표시됩니다.
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
Outlook에서 이름, EECoverageAmount 등 뒤에 필요한 줄 바꿈을 잘못 제거하는 방법에 유의하십시오.
전자 메일 수신자가 올바른 형식의 전자 메일을받는 것이 중요하며 일부는 Outlook 2003을 사용한다고 가정해야합니다. 또한 자동 정리 기능을 종료하여 메시지의 형식을 올바르게 지정하기에 충분하다는 것을 알지 못할 수도 있습니다.
다른 메일 클라이언트에서이 메시지를보고 올바르게 표시합니다
더 많은 정보 :
- UTF-8 BodyEncoding (msg.BodyEncoding = System.Text.Encoding.UTF8)을 사용하고 있습니다.
- UTF-8로 인코딩 된 텍스트 파일에서 msg.Body를 읽고 있으며 각 행은 crlf로 종료됩니다.
질문 :이 문제를 피하기 위해 메시지 형식을 어떻게 변경합니까?
두 줄의 공백으로 모든 줄을 시작하면 서식을 유지하기 위해 "트릭"됩니다.
따라서 변경
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%
에
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
여기입니다 기사 내 대답보다 조금 더 깊이 들어가는이 문제를 연구 할 때 내가 찾은이.
줄 의 끝에 CR 문자 바로 앞에 탭 문자를 삽입 할 수도 있습니다 . 이 추가 공백은 줄의 끝에 있으므로 사용자에게는 보이지 않습니다. 왼쪽에 공백을 삽입하는 것이 좋습니다. 단일 공간으로는 충분하지 않습니다 (여러 공간이 도움이 될지 모르지만).
이 답변은 Outlook 클라이언트에서 기능을 "비활성화"하는 방법에 대한 것입니다.
- 도구-> "옵션 ..."으로 이동하십시오.
- "환경 설정"탭에서 "이메일 옵션 ..."을 클릭하십시오.
- "일반 텍스트 메시지에서 추가 줄 바꿈 제거"확인란을 선택 취소하십시오.
- 확인을 누르십시오
참고 : Outlook 2007을 사용하고 있습니다.
I have always had better luck formatting e-mails as html. You may still have the end-user issue of having to set the client to allow html format, but they are usually more familiar with this since so many e-mails do come html formatted. You also have a little more work on your end adding the html tags, but the end result is much more controllable.
@ephemient also suggests: Send as both HTML and plaintext. Good clients will show the latter, Outlook will show the former, everybody is happy (except the programmer who has to do more work).
Adding "\t\r\n" ( \t for TAB) instead of "\r\n" worked for me on Outlook 2010.
Expanding on the Doug L answer, since I think HTML messaging is even more ubiquitous and accepted now than in 2008 when that answer was posted. Here is a little c# snippet to help convert the body and send the message in HTML format:
body = string.Format("<font face='calibri,arial,sans-serif'>{0}<font/>", body.Replace("\r\n", "<br>"));
using (var smtpClient = new SmtpClient() { Host = smtpHost })
using (var msg = new MailMessage(from, emailDistribution, subject, body) { IsBodyHtml = true })
smtpClient.Send(msg);
I'm seeing the same problem when generating a plain-text email and then reading it with Outlook 2003 SP3. It appears you can avoid the removal process by it by keep the line length under 40 characters. May not always be practical.
Put the text in <pre> Tags and outlook will format and display the text correctly.
i defined it in CSS inline in HTML Body like:
CSS:
pre {
font-family: Verdana, Geneva, sans-serif;
}
i defined the font-family to have to font set.
HTML:
<td width="70%"><pre>Entry Date/Time: 2013-09-19 17:06:25
Entered By: Chris
worklog mania
____________________________________________________________________________________________________
Entry Date/Time: 2013-09-19 17:05:42
Entered By: Chris
this is a new Worklog Entry</pre></td>
Auto cleaning is an outlook feature which removes extra line breaks. You can prevent it by two ways.
First way is to add at least 2 extra spaces before lines while sending the email through code. You can add these extra spaces only before those lines which outlook automatically removes.
Second way is to change outlook setting which will prevent outlook from removing extra line breaks.
My text includes '\r\n' but Outlook 2010 does not render line break. Create tokens of lines delimited by '\r\n' and envelope tokens by HTML Paragraph tags. My Email format is HTML. I am generating HTML Body for my email in the code below.
string[] tokens = Regex.Split(objTickt.Description, "\r\n");
if (tokens.Length > 0)
{
foreach (string line in tokens)
{
//htmlTW.WriteEncodedText(objTickt.Description.Replace("\r\n", "\n\n"));
htmlTW.RenderBeginTag(HtmlTextWriterTag.P);
htmlTW.WriteEncodedText(line);
htmlTW.RenderEndTag();
}
}
Change your line termination from crlf to either cr or lf.
I suspect that the top of the email uses only cr (or lf), and Outlook expects the rest of the email to follow the same format.
'IT박스' 카테고리의 다른 글
| 자산 파일에서 URI를 얻는 방법? (0) | 2020.07.30 |
|---|---|
| Java JDK가 Mac에 설치되어 있는지 어떻게 확인합니까? (0) | 2020.07.30 |
| PHP에서 함수가 바이너리 안전하다는 것은 무엇을 의미합니까? (0) | 2020.07.30 |
| 주문 목록의 시작 번호를 지정할 수 있습니까? (0) | 2020.07.30 |
| XMLHttpRequest가 파일을로드 할 수 없습니다. (0) | 2020.07.30 |

