如何配置SmtpClient服务器的ip地址 [英] how to configure SmtpClient server ip address

查看:601
本文介绍了如何配置SmtpClient服务器的ip地址的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

我想为SmtpClient配置IP地址。



I want to configure IP address to the SmtpClient.

var smtp = new System.Net.Mail.SmtpClient();
        {
            smtp.Host = "127.0.0.0";
            smtp.Port = 25;
            smtp.EnableSsl = true;
            smtp.DeliveryMethod = System.Net.Mail.SmtpDeliveryMethod.Network;
            smtp.Credentials = new NetworkCredential(fromAddress, fromPassword);
            smtp.Timeout = 20000;
        }
        try
        {
            smtp.Send(fromAddress, toAddress, subject, body);
        }
        catch(Exception ex) {
            Response.Write(ex);
        }





如何配置服务器IP地址



How to configure server IP address

推荐答案

尝试端口465或587而不是



465开始未加密然后切换到SSL。

587从SSL开始



您需要什么取决于邮件服务器。
Try port 465 or 587 instead

465 starts unencrypted and then switches to SSL.
587 starts with SSL

What you need depends on the mail server.


如评论中所述,您需要找出正确的IP地址然后填写它在你的代码中。如果您有SMTP管理员,则可以找到这个。
As mentioned in the comments, you need to find out what the proper IP address is and then fill it in in your code. This will be found by your SMTP admin, if you have one.


我提供了错误的IP地址。
I have given Wrong IP address.


这篇关于如何配置SmtpClient服务器的ip地址的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

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