关于发邮件的服务器的端口号

本文介绍了在使用SMTP服务器发送邮件时遇到的问题及解决方案。当默认端口25因spam等问题无法使用时,可以尝试更换为587端口。文章还提供了C#中使用SmtpClient实现邮件发送的方法。

 

今天搞一个发邮件的小功能,一切参数设置好,就是服务器没响应。

一开始怀疑是邮件服务器设置不对,邮件服务器和outlook中找到的是一致的。

怀疑端口号25不对。大部分资料都说是25呀。

。。。

后来找到这个网页,说

Usually an outgoing server employs port 25: it's the default SMTP port. However, some IPs deny its use because of the massive spam and malware traffic by which is affected. This issue is raised in particular when you need to switch to another ISP – for instance, when you're travelling and connecting to a new provider. In this case you can try to use port 587 or port 465 to avoid the block. 

More in detail: port 587 is supported by almost every outgoing SMTP server and it's useful for unencrypted or TLS connections; while port 465 is the right choice if you need to connect via SSL.

摘自:http://www.serversmtp.com/en/port-for-smtp

即:25是默认端口,可能因为spam等原因用不了,这时可以考虑587.一般对于非加密的请求587都能用。

修改端口号为587后,果然OK。

 

 

附:

C#开发邮件客户端使用SmtpClient。

使用原理:需要设置邮件服务器地址,及端口号。

 

转载于:https://www.cnblogs.com/poshi/p/5628491.html

评论
添加红包

请填写红包祝福语或标题

红包个数最小为10个

红包金额最低5元

当前余额3.43前往充值 >
需支付:10.00
成就一亿技术人!
领取后你会自动成为博主和红包主的粉丝 规则
hope_wisdom
发出的红包
实付
使用余额支付
点击重新获取
扫码支付
钱包余额 0

抵扣说明:

1.余额是钱包充值的虚拟货币,按照1:1的比例进行支付金额的抵扣。
2.余额无法直接购买下载,可以购买VIP、付费专栏及课程。

余额充值