SMTPClient半工作\\半不 [英] SMTPClient Half Working \ Half Not

查看:427
本文介绍了SMTPClient半工作\\半不的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

我使用的一个网站上微软的会员框架。我能够发送密码检索电子邮件,但我无法发送自己使用SMTPClient电子邮件。

I am using Microsoft's membership framework on a website. I am able to send password retrieval e-mails, but am unable to send e-mails myself using SMTPClient.

当您在网站管理工具配置SMTP设置,什么是这个应用程序给它SMTPclient?设置

When you configure the SMTP settings in the Web Site Administration Tool, what are the settings that this application give it's SMTPclient?

如果我知道,我可以复制它,并希望发送电子邮件。

If I know this, I can duplicate it and hopefully send e-mails.

一个几个项目我已经排除了。
- 我使用25端口,(这是在中等信任允许的唯一的一个)。
- 这code ++工程,我的本地系统上

A few items I've ruled out. - I'm using port 25, (which is the only one allowed under medium trust). - This code works on my local system.

推荐答案

我试图通过与构造SMTPClient值。我没有意识到的是,SMTPClient显然从自动翻出的web.config中的值并使用这些。

I was attempting to pass the values for SMTPClient in with the constructor. What I failed to realize is that SMTPClient apparently automatically pulls the values from web.config and uses those.

这是试图通过我自己的价值(即使它们相同的地方);我无意中侵犯了信任级别导致安全异常。

By trying to pass my own values (even though they where identical); I inadvertently violated trust levels causing a security exception.

不要在SMTP信息传递在构造函数中,使用web.config中设置它,而且应该在中等信任没有问题。

Don't pass in smtp info in the constructor, use web.config to set it up, and there should be no problem in medium trust.

这篇关于SMTPClient半工作\\半不的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

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