发送纯/​​文本电子邮件和获取= 0D 0A =从服务器的电子邮件回复 [英] send plain/text email and getting =0D=0A in email response from server

查看:521
本文介绍了发送纯/​​文本电子邮件和获取= 0D 0A =从服务器的电子邮件回复的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

当我从我的网站发送电子邮件至 http://co.za 登记员和CC我的邮件我收到退回的电子邮件从他们那里,他们收到的电子邮件,但不能找到一些信息,因为它有添加到它那些有趣的人物。我看到,那就是在网站上previous职位,但没有一个答案似乎为我工作,我试图职位和博客对谷歌的很多东西。

When i send a email from my site to Uniform http://co.za registrar and cc myself in the mail i get an email returned from them that they received the email, but cannot find some of the information as it has those funny characters added to it. I saw that there was a previous post on the site but none of the answers seem to work for me, and i tried alot of post and blog on google.

该电子邮件的整个身体构造,你从注册商网站获得的模板,我用等的细节,我需要来填充和更换这些,然后发送邮件正文关处长。

The entire body of the email is constructed of the template you get from the registrar site and i used etc as the detail i need to populate and replace those, then send the body of the email off to the registrar.

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

我的code:

    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);

这code发送BCC副本给自己和它通过Outlook看起来一切似乎不错,我应该是,但是当他们收到的字符被添加。它似乎随机添加这些字符。那么显然为秒域名服务器无法找到请求失败。

This code send a bcc copy to myself and from the looks of it through outlook all seems fine and i should be but when they receive it the characters gets added. it seems to randomly add those characters. then obviously the request fails as the seconds name server cannot be found.

返回的电子邮件:

Administrative Info
Contact:   Administrator=0D=0A 4b. Title/posi=   (Administrator)
Company:   CompanyName Ltd
Postal:    P.O 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,

任何帮助将是AP preciated。

Any help would be appreciated.

请注意:注册商要求的电子邮件是纯文本格式,而不是64或任何HTML作为他们的系统拿起纯/文本电子邮件和传真,并自动对其进行处理。

note: the registrar requires the the email be in plain text and not base64 or html whatsoever as their system picks up plain/text email and faxes and automatically processes them.

感谢

推荐答案

我想通了,改变了我的code以下内容:

I figured it out, 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 characters spaces are kept like they should be in the email template. Hope this will help someone aswell.

这篇关于发送纯/​​文本电子邮件和获取= 0D 0A =从服务器的电子邮件回复的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

查看全文
登录 关闭
扫码关注1秒登录
发送“验证码”获取 | 15天全站免登陆