Send plain / text email and get = 0D = 0A in server email response

When I send an email from my website to the Uniform http://co.za registrar and cc itself in the letter, I receive an email received from them, which they received by email, but cannot find any information, since she added these funny characters. I saw that the site had a previous post, but none of the answers worked for me, and I tried a lot of posts and a blog on google.

All email is built from a template that you receive from the registrar’s site, and I used it, etc., as a part that I need to fill out and replace, and then send the email body to the registrar.

EX: 1a. Complete domain name: < domainname > gets replaces with the domain name exmaple.co.za 

My code is:

  MailMessage emailmsg = new MailMessage(" myemail@domain.co.za ", " coza-admin@co.za "); emailmsg.Subject = "N domain domain.co.za"; emailmsg.Bcc.Add(" myemail@domain.co.za "); emailmsg.Body = Body; emailmsg.IsBodyHtml = false; var plainView = AlternateView.CreateAlternateViewFromString(Body, new ContentType("text/plain; charset=iso-8859-1")); plainView.TransferEncoding = TransferEncoding.SevenBit; emailmsg.AlternateViews.Add(plainView); SmtpClient sSmtp = new SmtpClient(); sSmtp.Send(emailmsg); 

This code sends a copy of the instance to itself and from the look of it through the look, everything seems fine, and I should be, but when they get it, the characters are added. they seem to accidentally add these characters. then, obviously, the request does not work, because the second name server cannot be found.

Returned Email Address:

 Administrative Info Contact: Administrator=0D=0A 4b. Title/posi= (Administrator) Company: CompanyName Ltd Postal: PO Box 12841, Centrahill, 6006 Phone: +27.00000000=0D=0A 4f. Fax Number: +27.00000000= Provided Nameserver information Primary Server : ns1.nameserver.co.za Secondary 1 : ns2.nameserver.co.za=0d=0a, 

Any help would be appreciated.

Note: the registrar requires that the email is in plain text, not base64 or html, because their system picks up a simple / text email address and faxes and automatically processes them.

thanks

+6
source share
2 answers

I realized I changed my code to the following:

 MailMessage emailmsg = new MailMessage(" from@address.co.za ", " to@address.co.za ") emailmsg.Subject = "Subject"; emailmsg.IsBodyHtml = false; emailmsg.ReplyToList.Add(" from@address.co.za "); emailmsg.BodyEncoding = System.Text.Encoding.UTF8; emailmsg.HeadersEncoding = System.Text.Encoding.UTF8; emailmsg.SubjectEncoding = System.Text.Encoding.UTF8; emailmsg.Body = null; var plainView = AlternateView.CreateAlternateViewFromString(EmailBody, emailmsg.BodyEncoding, "text/plain"); plainView.TransferEncoding = TransferEncoding.SevenBit; emailmsg.AlternateViews.Add(plainView); SmtpClient sSmtp = new SmtpClient(); sSmtp.Send(emailmsg); 

All character spaces are saved as if they should be in the email template. Hope this helps someone too.

+5
source

= OD = OA is a printable representation of CrLf.

If you want to use the iso-8859-1 character set, you need to get rid of this line:

 plainView.TransferEncoding = TransferEncoding.SevenBit; 

If you insist on using 7-bit encoding, you can only use ASCII characters in your letter, so change the character set is0-8859-1 to "us-ascii"

+5
source

Source: https://habr.com/ru/post/901067/


All Articles