如何在Email Body中发送.EML文件 [英] How to send .EML file in Email Body

查看:128
本文介绍了如何在Email Body中发送.EML文件的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

大家好...



如何使用c#windows应用程序在电子邮件正文内容中发送.EML文件。

Hi All...

How To send .EML files in email body content in using c# windows application.

推荐答案

不幸的是,如果你想使用.NET FCL类 System.Net.Mail.MailMessage ,你需要先解析你的* .EML将文件转换为 MailMessage (所有部件,标题等)所需的组件,并使用此类再次撰写邮件。而你必须自己解析一些可用的库。



请参阅:

http://msdn.microsoft.com/en-us/library/system.net.mail.mailmessage.aspx [ ^ ],

http:// msdn。 microsoft.com/en-us/library/system.net.mail.smtpclient.aspx [ ^ ]。



可用于解析的第三方库可能是OpenPOP.NET: http://hpop.sourceforge.net [ ^ ]。



这个库不是ver写得很好,但它完全遵循邮件,MIME等许多标准。



或者,您可以实现自己的方法,根据已经编写的EML发送邮件文件。这取决于您要使用的协议。在所有情况下,它都是基于TCP的应用层协议(在传输层中),因此您只需使用类系统.Net.Sockets.TcpClient

http://msdn.microsoft.com/en-us/library/system.net.sockets.tcpclient.aspx [ ^ ]。



另见:

http://en.wikipedia.org/wiki/Application_layer [< a href =http://en.wikipedia.org/wiki/Application_layertarget =_ blanktitle =New Window> ^ ],

http://en.wikipedia.org/wiki/Transport_layer [ ^ ],

http://en.wikipedia.org/wiki/Transmission_Control_Protocol [ ^ ],

http://en.wikipedia.org/wiki/Smtp [ ^ ]。



-SA
Unfortunately, if you want to use .NET FCL classes System.Net.Mail.MailMessage and , you would need first to parse your *.EML file into components needed for MailMessage (all parts, headers, etc.) and compose the message again using this class. And you would have to implement parsing by yourself of find some available library.

Please see:
http://msdn.microsoft.com/en-us/library/system.net.mail.mailmessage.aspx[^],
http://msdn.microsoft.com/en-us/library/system.net.mail.smtpclient.aspx[^].

The 3rd-party library you could use for parsing could be OpenPOP.NET: http://hpop.sourceforge.net[^].

This library is not very well written, but it thoroughly follows those many standards for mail, MIME, etc.

Alternatively, you could implement your own method for sending mail based on already composed EML file. It depends on the protocol you want to use. In all cases, it would be an application-layer protocol based on TCP (in the transport layer), so you could simply use the class System.Net.Sockets.TcpClient:
http://msdn.microsoft.com/en-us/library/system.net.sockets.tcpclient.aspx[^].

See also:
http://en.wikipedia.org/wiki/Application_layer[^],
http://en.wikipedia.org/wiki/Transport_layer[^],
http://en.wikipedia.org/wiki/Transmission_Control_Protocol[^],
http://en.wikipedia.org/wiki/Smtp[^].

—SA


这篇关于如何在Email Body中发送.EML文件的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

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