Domanda

When I send an HTML email (actually just generating .eml files rather than sending at the moment) using the .NET System.Net.Mail.MailMessage class, it seems to be adding addition decimal points to some of my numbers.

It is only adding the extra decimal point when the number is split over a new line and the first character on the new line would have been a dot.

Input:

[snip]27.50[snip]137.50[snip]

Output:

[snip]27.=
50[snip]=
[snip]137=
..50[snip]

When opened in Outlook, the first number outputs as 27.00 but the second (understandably) outputs 137..50 (too many decimal points!)

I know the equals is a "soft line break". Is there syntax for the extra .?

Why is it outputting 2 dots? Can I stop it doing this?

Non-snipped output:

<tr>=0D=0A          <td>=
Units</td><td>Standard Rate</td><td></td><td>25.00</td><td>27.=
50</td><td>25.00</td><td>625.00</td><td>687.50</td>=0D=0A       </tr><=
tr>=0D=0A           <td>Timesheet Units</td><td>Standard Rate</td><td></t=
d><td>25.00</td><td>27.50</td><td>5.00</td><td>125.00</td><td>137=
..50</td>=0D=0A     </tr>
È stato utile?

Soluzione

I suspect you're just running into the fact that a period at the start of a line is used to terminate a mail.

From RFC 2821 section 4.5.2:

4.5.2 Transparency

Without some provision for data transparency, the character sequence "." ends the mail text and cannot be sent by the user. In general, users are not aware of such "forbidden" sequences. To allow all user composed text to be transmitted transparently, the following procedures are used:

  • Before sending a line of mail text, the SMTP client checks the first character of the line. If it is a period, one additional period is inserted at the beginning of the line.
  • When a line of mail text is received by the SMTP server, it checks the line. If the line is composed of a single period, it is treated as the end of mail indicator. If the first character is a period and there are other characters on the line, the first character is deleted.

In other words, I suspect when the mail is actually sent, the receiver will only see one dot. It's not clear why Outlook would do the wrong thing here though...

Autorizzato sotto: CC-BY-SA insieme a attribuzione
Non affiliato a StackOverflow
scroll top