ASP.net SMTP邮件通过代理

时间:2022-06-24 18:10:11

How to setup SMTPClient in ASP.net with C# to send email with provided proxy address ? or sending by detecting the system default proxy

如何使用C#在ASP.net中设置SMTPClient以发送带有提供的代理地址的电子邮件?或通过检测系统默认代理发送

I used the the following code in web.config but didnt work

我在web.config中使用了以下代码但是没有用

<system.net>
    <defaultProxy enabled="true">
      <proxy bypassonlocal="False" proxyaddress="http://192.168.101.3:8080/" />
    </defaultProxy>
  </system.net>

2 个解决方案

#1


1  

You can't send SMTP email through an HTTP proxy server.

您无法通过HTTP代理服务器发送SMTP电子邮件。

Speak to the person administering your Internet gateway/firewall to ask what host they want you to direct outbound email to.

与管理您的Internet网关/防火墙的人员联系,询问他们希望您将哪些主机指向出站电子邮件。

#2


0  

Based on this article, you simply have to declare your proxy configuration into your Web.config and try to change the port:

根据本文,您只需将代理配置声明到Web.config中并尝试更改端口:

If you are still having problems them try changing port number to 587

如果您仍然遇到问题,请尝试将端口号更改为587

Edited my answer after your edit.

编辑后编辑我的答案。

#1


1  

You can't send SMTP email through an HTTP proxy server.

您无法通过HTTP代理服务器发送SMTP电子邮件。

Speak to the person administering your Internet gateway/firewall to ask what host they want you to direct outbound email to.

与管理您的Internet网关/防火墙的人员联系,询问他们希望您将哪些主机指向出站电子邮件。

#2


0  

Based on this article, you simply have to declare your proxy configuration into your Web.config and try to change the port:

根据本文,您只需将代理配置声明到Web.config中并尝试更改端口:

If you are still having problems them try changing port number to 587

如果您仍然遇到问题,请尝试将端口号更改为587

Edited my answer after your edit.

编辑后编辑我的答案。