如何创建用于从桌面应用程序发送邮件的smtp服务器? [英] How to create smtp server for sending mail from desktop application?

查看:140
本文介绍了如何创建用于从桌面应用程序发送邮件的smtp服务器?的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

如何在桌面上轻松发送邮件创建smtp服务器?

先谢谢你...

How to create smtp server in an easy for sending mail from desktop?
Thanks in Advance...

推荐答案

如果你看看SMTP协议,你会看到这是应用程序级协议,就在传输层 TCP之上:

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

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

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



因此,请记住TCP完全可从.NET FCL获得,您必须基于TCP实现SMTP。您不必使用原始套接字,可以使用更方便的 TcpListener 。请参阅:

https://msdn.microsoft.com/en-us/library/system.net.sockets.tcplistener%28v=vs.110%29.aspx [ ^ ],

https:// msdn。 microsoft.com/en-us/library/system.net.sockets.socket(v=vs.110).aspx [ ^ ],

https://msdn.microsoft.com/en-us/library/ System.Net.Sockets%28v = vs.110%29.aspx [ ^ ] 。



协议本身在 RFC 此处引用的标准 IETF 文件: http://en.wikipedia.org/wiki/Simple_Mail_Transfer_Protocol [ ^ ]。



但是......为什么?你会在哪里托管你的服务器?为什么不使用现有和可操作的东西?



-SA
If you look at SMTP protocol, you will see that this is the application-level protocol, right on top of transport-layer TCP:
http://en.wikipedia.org/wiki/Application_layer[^],
http://en.wikipedia.org/wiki/Transport_layer[^],
http://en.wikipedia.org/wiki/Transmission_Control_Protocol[^].

Therefore, keeping in mind that TCP is fully available from .NET FCL, you have to implement SMTP based on TCP. You don't have to use raw sockets, you can use more convenient TcpListener. Please see:
https://msdn.microsoft.com/en-us/library/system.net.sockets.tcplistener%28v=vs.110%29.aspx[^],
https://msdn.microsoft.com/en-us/library/system.net.sockets.socket(v=vs.110).aspx[^],
https://msdn.microsoft.com/en-us/library/System.Net.Sockets%28v=vs.110%29.aspx[^].

The protocol itself is completely described in the RFC standard IETF documents referenced here: http://en.wikipedia.org/wiki/Simple_Mail_Transfer_Protocol[^].

But… why? And where would you host your server? Why not using something already existing and operational?

—SA


这篇关于如何创建用于从桌面应用程序发送邮件的smtp服务器?的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

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