SMTPClient 一半工作\一半不工作

发布于 2024-07-14 16:30:58 字数 232 浏览 4 评论 0原文

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

当您在网站管理工具中配置 SMTP 设置时,该应用程序为其 SMTP 客户端提供哪些设置?

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

我已经排除了一些项目。 - 我正在使用端口 25(这是中等信任度下唯一允许的端口)。 - 此代码适用于我的本地系统。

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.

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.

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.

如果你对这篇内容有疑问,欢迎到本站社区发帖提问 参与讨论,获取更多帮助,或者扫码二维码加入 Web 技术交流群。

扫码二维码加入Web技术交流群

发布评论

需要 登录 才能够评论, 你可以免费 注册 一个本站的账号。

评论(3

我ぃ本無心為│何有愛 2024-07-21 16:30:58

我试图使用构造函数传递 SMTPClient 的值。 我没有意识到的是 SMTPClient 显然会自动从 web.config 中提取值并使用这些值。

通过尝试传递我自己的价值观(即使它们相同); 我无意中违反了信任级别,导致安全异常。

构造函数中不要传入smtp信息,使用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.

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.

最单纯的乌龟 2024-07-21 16:30:58

原因可能有很多,比如凭证问题、DNS 问题,或者……谁知道呢。 是否无法发送,因为您收到错误或它们似乎已发送但从未到达?

您确定 WSA 工具正在通过 SMTPClient,还是您只是假设它(我自己也不知道)?

——马库斯Q

我收到了安全异常
我的邮件

这听起来像是一个凭据问题,或者是一个信任问题。 您确定您正在以中等(或更高)信任度运行吗? 剩下的错误是什么?

——马库斯Q

It could be lots of things, from credential problems, DNS issues, or...who knows. Is it unable to send as in you get an error or as in they appear to go but never arrive?

Are you sure the WSA tool is going through SMTPClient, or are you just assuming it (I don't know myself)?

-- MarkusQ

I am getting a Security Exception on
my mail

That sounds like a credentials problem then, or a trust issue. Are you sure you're running at medium (or higher) trust? What's the rest of the error?

-- MarkusQ

蝶…霜飞 2024-07-21 16:30:58

尝试检查您的 web.config 文件:WSA 工具是否正在更新这些设置?

该元素位于配置元素下

<system.net>
<mailSettings>
  <smtp deliveryMethod="Network" from="[email protected]">
    <network
         host="your.gateway.com"
         userName="[email protected]"
         password="your_password"
         port="25" />
  </smtp>
</mailSettings>
</system.net>

Try checking your web.config file: is the WSA tool updating these settings?

This element is under the configuration element

<system.net>
<mailSettings>
  <smtp deliveryMethod="Network" from="[email protected]">
    <network
         host="your.gateway.com"
         userName="[email protected]"
         password="your_password"
         port="25" />
  </smtp>
</mailSettings>
</system.net>
~没有更多了~
我们使用 Cookies 和其他技术来定制您的体验包括您的登录状态等。通过阅读我们的 隐私政策 了解更多相关信息。 单击 接受 或继续使用网站,即表示您同意使用 Cookies 和您的相关数据。
原文