简体   繁体   English

调试模式仅适用于在C#中发送电子邮件

[英]Debug mode only works sending email in C#

i wrote a sending email function that only works on my debug mode(debug local server) when i publishing and hosting C# code that function doesn't work. 我写了一个发送邮件功能,只有当我发布和托管功能不起作用的C#代码时才能在我的调试模式(调试本地服务器)上运行。 This is my email configuration function 这是我的电子邮件配置功能

<configuration>
    <system.net>
        <mailSettings>
            <smtp from="admin@XXXX.com">
                <network host="smtp.XXXXX.com" port="25"
                         userName="admin@XXXXX.com" password="XXXXX" />
            </smtp>
        </mailSettings>
    </system.net>
    <appSettings/>
    <connectionStrings/>
    <system.web>

I have found a lot of times that there can be a firewall or antivirus (with built in firewall) blocking outgoing smtp traffic. 我发现很多时候可以使用防火墙或防病毒软件(内置防火墙)来阻止传出的smtp流量。 You may also want to check with the network administrator that the mail server will allow smtp traffic from the server you are sending from. 您可能还想与网络管理员核实邮件服务器是否允许来自您发送的服务器的smtp流量。

声明:本站的技术帖子网页,遵循CC BY-SA 4.0协议,如果您需要转载,请注明本站网址或者原文地址。任何问题请咨询:yoyou2525@163.com.

 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM