本文介绍了通过c#代码发送电子邮件的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧! 问题描述 29岁程序员,3月因学历无情被辞! 大家好, 我用谷歌搜索了这个并找到了一些答案,但没有一个给我的确是 我在追求什么,也许有人在这里可以帮忙。 我有一个应用程序,将分发给用户的笔记本电脑和 家用电脑,我不知道什么操作系统他们正在使用虽然它们至少是Win 98,但我也不知道他们将使用什么邮件客户端或者他们的邮件帐户使用哪个ISP。我想 使用他们的默认邮件帐户从应用程序发送一封电子邮件,我有一个 看看System.Web.Mail类,特别是MailMessage类,但是 这需要一个邮件服务器,我如何从 系统获取这些信息?它还需要一个来自现场的邮件,我希望从系统中获得而不要求用户输入它,再次如何实现这个 ? 还有另外一种方法可以做我想做的事情,我知道有一些 Indy组件,但我宁愿避免更多的Dll''' s, 除非Indy路线是最好的。 我唯一可以保证的是这款应用的目标机器 $ b安装$ b将有一个邮件帐户。 非常感谢 JoeHi all,I have googled this and found some answers but none that give me exactlywhat I''m after, maybe someone here can help.I have an app that will be distributed to users for their laptop andhome PC''s, I have no idea what operating system they are using althoughit will be at least Win 98, I also have no idea what mail client theywill be using or which ISP their mail account is with. I would like tosend an email from the app using their default mail account, I had alook at the System.Web.Mail classes, specifically MailMessage class, butthis requires a mail server, how would I get this information from thesystem? also it requires a mail from field which I would like to getfrom the system without asking the user to enter it, again how is thisachieved?Is there another way to do what I want to do, I know that there are theIndy components but I''d rather avoid having to distibute more Dll''s,unless the Indy route is the best.The only thing I can guarantee is that the target machine that this appis installed on will have a mail account.Many thanksJoe推荐答案 这是否意味着来自地址不一定是有效的电子邮件 地址?即 他们的实际电子邮件是 so*****@ansmtpserver.com 但是MailMessage对象中的起始地址可以设置为 re ********** @ adomain.com 非常感谢 JoeDoes this mean that the from address does not have to be a valid emailaddress? i.e.Their actual email is so*****@ansmtpserver.combut the from address in the MailMessage object could be set to re**********@adomain.comMany thanksJoe 嗨亚当, 嗯,我想认为用户会有能力进入 smtp服务器的详细信息:-),但是我们的目标受众真的不会那样计算机知识。此外,应用程序的电子邮件部分唯一需要的时间是他们注册他们的软件,所以理想情况下我希望它是一个简单的点击并为他们服务的案例。 /> Hi Adam, Hmmm, I''d like to think the users would have the abilty to do enter the smtp server details :-), however our target audience wont really be that computer literate. Also the only time the email part of the app will be needed is when they register their software, so ideally I''d like it to be a simple case of click and go for them. 这是否意味着从地址不一定是有效的电子邮件地址?即 他们的实际电子邮件是 so*****@ansmtpserver.com 但是MailMessage对象中的from地址可以设置为 re * *********@adomain.com 非常感谢 Joe Does this mean that the from address does not have to be a valid email address? i.e. Their actual email is so*****@ansmtpserver.com but the from address in the MailMessage object could be set to re**********@adomain.com Many thanks Joe 这篇关于通过c#代码发送电子邮件的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持! 上岸,阿里云! 07-23 19:00