System.Net.Mail creating invalid emails and eml files? Inserting extra dots in host names

后端 未结 3 372
情深已故
情深已故 2020-11-30 01:02

It appears that .NET\'s SmtpClient is creating emails with an extra dot in host names if the dot was to appear at the beginning of a MIME encoded line (e.g. test.com sometim

3条回答
  •  情深已故
    2020-11-30 02:06

    In .Net 2.0

    X-Sender: test@test.com
    X-Receiver: Test@test.com
    MIME-Version: 1.0
    From: test@test.com
    To: Test@test.com
    Date: 6 Jul 2011 21:29:04 +0100
    Subject: Test
    Content-Type: text/plain; charset=us-ascii
    Content-Transfer-Encoding: quoted-printable
    
    Hello this is  a short test of the issue: https://test.com/:=
    

    It looks like it is wrapping the text at a certain character length per line. I vaguely remember there was an issue in .Net 2.0 where by default it doesn't do this which can cause problems with spam filters.

    In fact increasing the size of the message gives the following in .Net 4.0:

    X-Sender: test@test.com
    X-Receiver: Test@test.com
    MIME-Version: 1.0
    From: test@test.com
    To: Test@test.com
    Date: 6 Jul 2011 21:34:21 +0100
    Subject: Test
    Content-Type: text/plain; charset=us-ascii
    Content-Transfer-Encoding: quoted-printable
    
    Hello this is  a short test of the sssssssssssssssssissue: https://test.com/:=20
    

    Seems like a bug.

    A workaround might be to change the BodyEncoding to something other than ASCII.

提交回复
热议问题