社区
C#
帖子详情
请各位发个邮件中quoted printable的编码函数,c#的,不要解码,只要编码的~
liuguozhong
2007-03-20 08:49:52
如题,谢谢了~
...全文
252
9
打赏
收藏
请各位发个邮件中quoted printable的编码函数,c#的,不要解码,只要编码的~
如题,谢谢了~
复制链接
扫一扫
分享
转发到动态
举报
AI
作业
写回复
配置赞助广告
用AI写文章
9 条
回复
切换为时间正序
请发表友善的回复…
发表回复
打赏红包
王集鹄
2007-03-20
打赏
举报
回复
//硬写一个也不难...
using System.Collections;
using System.Globalization;
public string QuotedPrintableEncode(string AText) // QP编码
{
string Result = "";
byte[] vBuffer = Encoding.Default.GetBytes(AText);
foreach(byte vByte in vBuffer)
// 可见字符并非"="(#61)
if ((vByte >= 33 && vByte <= 60) || (vByte >= 62 && vByte <= 126))
Result += (char)vByte;
else Result += "=" + vByte.ToString("X2");
return Result;
}
public static string QuotedPrintableDecode(string ACode) // 解码
{
ArrayList vBuffer = new ArrayList();
for(int i = 0; i < ACode.Length; i++)
{
if (ACode[i] == '=')
{
i++;
if (ACode[i] != '\r')
{
byte vByte;
if (byte.TryParse(ACode.Substring(i, 2),
NumberStyles.HexNumber, null, out vByte))
vBuffer.Add(vByte);
}
i++;
}
else if (ACode[i] != '\n') vBuffer.Add((byte)ACode[i]);
}
return Encoding.Default.GetString((byte[])vBuffer.ToArray(typeof(byte)));
}
private void button1_Click(object sender, EventArgs e)
{
Text = QuotedPrintableDecode(QuotedPrintableEncode("zswang 路过"));
}
liuguozhong
2007-03-20
打赏
举报
回复
zswang(伴水清清)(专家门诊清洁工) :
先谢过,可是我要字符串转化为qp编码呢~
王集鹄
2007-03-20
打赏
举报
回复
附件里可以指定编码方式,参考:
Attachment vAttachment = new Attachment("yourfile");
vAttachment.TransferEncoding = System.Net.Mime.TransferEncoding.QuotedPrintable;
liuguozhong
2007-03-20
打赏
举报
回复
50分没人要啊~
richard530
2007-03-20
打赏
举报
回复
up~
liuguozhong
2007-03-20
打赏
举报
回复
再顶一下,怎么没有人帮忙呀~
liuguozhong
2007-03-20
打赏
举报
回复
人工置顶~
liuguozhong
2007-03-20
打赏
举报
回复
顶一下,谢谢了~
liuguozhong
2007-03-20
打赏
举报
回复
感谢~
Quote
d-
pr
int
able
编码
介绍、
Quote
d-
pr
int
able
编码
解码
转换方法
Quote
d-
pr
int
able
编码
是一种用于电子
邮件
传输
中
的字符
编码
方案,它允许文本包含一些非ASCII字符,同时保持
邮件
的可读性。
Quote
d-
pr
int
able
编码
利用可打印的ASCII字符来表示原始数据
中
可能无法直接显示的字节,尤其是...
C#
邮件
发送接收+
邮件
内容
解码
总之,
C#
中
的
邮件
发送和接收是通过SmtpClient和Pop3类实现的,
邮件
内容的
解码
则需要理解各种
编码
方式并可能利用特定的库或自定义
函数
。通过提供的源码,你可以深入学习和实践这些技术,更好地掌握
邮件
通信的
C#
实现。
C#
邮件
接收案例源码.rar.rar
C#
支持Base64、
Quote
d-
Pr
int
able
等
编码
方式,可以使用`MimeKit`或`System.Net.Mail`自带的
函数
进行处理。 7. **SSL/TLS安全连接** 为了保证
邮件
传输的安全性,SMTP和POP3服务器通常支持SSL或TLS加密。在
C#
中
,可以...
邮件
MIME的解析
3. **
编码
解码
**:MIME允许使用多种
编码
方法,如Base64、
Quote
d-
Pr
int
able
等,来
编码
非ASCII字符和二进制数据。解析器需要将这些
编码
还原为原始格式。 4. **多部分处理**:如果
邮件
主体是"multipart"类型,意味着...
elm.txt
- **示例**:程序支持 `base64`、`
quote
d-
pr
int
able
`、`8bit` 和 `7bit`
编码
方式。根据不同的
编码
方式,程序采用不同的方法
解码
数据。 ### 4. 具体实现细节 - **字段初始化**:`Attachment` 类包含多个私有字段,...
C#
111,098
社区成员
642,554
社区内容
发帖
与我相关
我的任务
C#
.NET技术 C#
复制链接
扫一扫
分享
社区描述
.NET技术 C#
社区管理员
加入社区
获取链接或二维码
近7日
近30日
至今
加载中
查看更多榜单
社区公告
让您成为最强悍的C#开发者
试试用AI创作助手写篇文章吧
+ 用AI写文章