配置 MailEnable 以出现 SSL 错误:服务器不支持安全连接

配置 MailEnable 以出现 SSL 错误:服务器不支持安全连接

我使用 MailEnable 通过 mailhost 从我的 Windows Server 2016 VPS 发送电子邮件localhost。使用此代码一切正常:

Dim mailObj As New SmtpClient
mailObj.Host = "localhost"
mailObj.Port = 25

但是,当我尝试通过 SSL 发送电子邮件时,出现错误:

服务器不支持安全连接。

  • 我在 Windows 防火墙中打开了 SMTP 端口 587
  • 我获得了域名的 SSL 证书并分配给 MailEnable:example.com、www.example.com、smtp.example.com、mail.example.com、ftp.example.com、pop.example.com
  • 配置MailEnable,也使用上面的证书

我的后端代码:

Dim mailObj As New SmtpClient
mailObj.Host = "localhost"
mailObj.EnableSsl = True
mailObj.Port = 587
mailObj.UseDefaultCredentials = false
mailObj.Credentials = New System.Net.NetworkCredential("[email protected]", "mypwd")

当我检查Enable TLS下面的第一个屏幕截图时出现错误:

邮件发送失败。

这是我启用后获得的日志Enable TLS

[06/23/20 22:33:31]****************** LOG FILE STARTED *******************
06/23/20 22:33:31   SMTP-IN A4C36F71EB8A4F0C8708CD88F4DF3671.MAI    1020    212.60.249.12           220 mail.example.com ESMTP MailEnable Service, Version: 7.59-7.59- ready at 06/23/20 22:33:31   0   0       
06/23/20 22:33:32   SMTP-IN FFD462EEB67B44159FF086464B9D3C5E.MAI    1036    212.70.149.50           220 mail.example.com ESMTP MailEnable Service, Version: 7.59-7.59- ready at 06/23/20 22:33:32   0   0       
06/23/20 22:33:33   SMTP-IN BDFF4AEDD8B94D0987166BA0DEAC1FC0.MAI    1060    185.143.72.34           220 mail.example.com ESMTP MailEnable Service, Version: 7.59-7.59- ready at 06/23/20 22:33:33   0   0       
06/23/20 22:33:33   SMTP-IN A4C36F71EB8A4F0C8708CD88F4DF3671.MAI    1020    212.60.249.12   EHLO    EHLO User   250-example.com [212.60.249.12], this server offers 5 extensions    143 11      
06/23/20 22:33:34   SMTP-IN FFD462EEB67B44159FF086464B9D3C5E.MAI    1036    212.70.149.50   EHLO    EHLO User   250-example.com [212.70.149.50], this server offers 5 extensions    143 11      
06/23/20 22:33:34   SMTP-IN BDFF4AEDD8B94D0987166BA0DEAC1FC0.MAI    1060    185.143.72.34   EHLO    EHLO User   250-example.com [185.143.72.34], this server offers 5 extensions    143 11      
06/23/20 22:33:34   SMTP-IN A4C36F71EB8A4F0C8708CD88F4DF3671.MAI    1020    212.60.249.12   RSET    RSET    250 Requested mail action okay, completed   43  6       
06/23/20 22:33:35   SMTP-IN FFD462EEB67B44159FF086464B9D3C5E.MAI    1036    212.70.149.50   RSET    RSET    250 Requested mail action okay, completed   43  6       
06/23/20 22:33:35   SMTP-IN BDFF4AEDD8B94D0987166BA0DEAC1FC0.MAI    1060    185.143.72.34   RSET    RSET    250 Requested mail action okay, completed   43  6       
06/23/20 22:33:36   SMTP-IN A4C36F71EB8A4F0C8708CD88F4DF3671.MAI    1020    212.60.249.12   AUTH    AUTH LOGIN  334 VXNlcm5hbWU6    18  12      
06/23/20 22:33:37   SMTP-IN BDFF4AEDD8B94D0987166BA0DEAC1FC0.MAI    1060    185.143.72.34   AUTH    AUTH LOGIN  334 VXNlcm5hbWU6    18  12      
06/23/20 22:33:37   SMTP-IN FFD462EEB67B44159FF086464B9D3C5E.MAI    1036    212.70.149.50   AUTH    AUTH LOGIN  334 VXNlcm5hbWU6    18  12      
06/23/20 22:33:37   SMTP-IN D50DB0BE07584F9484734E4E911EE303.MAI    1104    185.143.75.153          220 mail.example.com ESMTP MailEnable Service, Version: 7.59-7.59- ready at 06/23/20 22:33:37   0   0       
06/23/20 22:33:37   SMTP-IN A4C36F71EB8A4F0C8708CD88F4DF3671.MAI    1020    212.60.249.12   AUTH    {blank} 334 UGFzc3dvcmQ6    18  30  [email protected]  
06/23/20 22:33:38   SMTP-IN D50DB0BE07584F9484734E4E911EE303.MAI    1104    185.143.75.153  EHLO    EHLO User   250-example.com [185.143.75.153], this server offers 5 extensions   144 11      
06/23/20 22:33:38   SMTP-IN BDFF4AEDD8B94D0987166BA0DEAC1FC0.MAI    1060    185.143.72.34   AUTH    {blank} 334 UGFzc3dvcmQ6    18  30  [email protected] 
06/23/20 22:33:38   SMTP-IN 09B37BA353F34F3EA5A98E682F9E963C.MAI    1120    212.70.149.18           220 mail.example.com ESMTP MailEnable Service, Version: 7.59-7.59- ready at 06/23/20 22:33:38   0   0       
06/23/20 22:33:38   SMTP-IN FFD462EEB67B44159FF086464B9D3C5E.MAI    1036    212.70.149.50   AUTH    {blank} 334 UGFzc3dvcmQ6    18  30  [email protected]   
06/23/20 22:33:39   SMTP-IN D50DB0BE07584F9484734E4E911EE303.MAI    1104    185.143.75.153  RSET    RSET    250 Requested mail action okay, completed   43  6       
06/23/20 22:33:39   SMTP-IN A4C36F71EB8A4F0C8708CD88F4DF3671.MAI    1020    212.60.249.12   AUTH    bGV0bWVpbg==    504 Invalid Username or Password    34  14  [email protected]  
06/23/20 22:33:39   SMTP-IN BDFF4AEDD8B94D0987166BA0DEAC1FC0.MAI    1060    185.143.72.34   AUTH    Rk9VUklFUg==    504 Invalid Username or Password    34  14  [email protected] 
06/23/20 22:33:39   SMTP-IN 09B37BA353F34F3EA5A98E682F9E963C.MAI    1120    212.70.149.18   EHLO    EHLO User   250-example.com [212.70.149.18], this server offers 5 extensions    143 11      
06/23/20 22:33:40   SMTP-IN D50DB0BE07584F9484734E4E911EE303.MAI    1104    185.143.75.153  AUTH    AUTH LOGIN  334 VXNlcm5hbWU6    18  12      
06/23/20 22:33:40   SMTP-IN FFD462EEB67B44159FF086464B9D3C5E.MAI    1036    212.70.149.50   AUTH    UEBzc3cwcmQ=    504 Invalid Username or Password    34  14  [email protected]   
06/23/20 22:33:40   SMTP-IN 09B37BA353F34F3EA5A98E682F9E963C.MAI    1120    212.70.149.18   RSET    RSET    250 Requested mail action okay, completed   43  6       
06/23/20 22:33:40   SMTP-IN 09B37BA353F34F3EA5A98E682F9E963C.MAI    1120    212.70.149.18   AUTH    AUTH LOGIN  334 VXNlcm5hbWU6    18  12      
06/23/20 22:33:40   SMTP-IN BDFF4AEDD8B94D0987166BA0DEAC1FC0.MAI    1060    185.143.72.34   QUIT    QUIT    221 Service closing transmission channel    42  6   [email protected] 
06/23/20 22:33:40   SMTP-IN A4C36F71EB8A4F0C8708CD88F4DF3671.MAI    1020    212.60.249.12   QUIT    QUIT    221 Service closing transmission channel    42  6   [email protected]  
06/23/20 22:33:41   SMTP-IN D50DB0BE07584F9484734E4E911EE303.MAI    1104    185.143.75.153  AUTH    {blank} 334 UGFzc3dvcmQ6    18  26  [email protected] 
06/23/20 22:33:41   SMTP-IN 09B37BA353F34F3EA5A98E682F9E963C.MAI    1120    212.70.149.18   AUTH    {blank} 334 UGFzc3dvcmQ6    18  30  [email protected]  
06/23/20 22:33:41   SMTP-IN FFD462EEB67B44159FF086464B9D3C5E.MAI    1036    212.70.149.50   QUIT    QUIT    221 Service closing transmission channel    42  6   [email protected]   
06/23/20 22:33:42   SMTP-IN D50DB0BE07584F9484734E4E911EE303.MAI    1104    185.143.75.153  AUTH    MTExMQ==    504 Invalid Username or Password    34  10  [email protected] 
06/23/20 22:33:42   SMTP-IN 09B37BA353F34F3EA5A98E682F9E963C.MAI    1120    212.70.149.18   AUTH    bXl0aW1lMDE=    504 Invalid Username or Password    34  14  [email protected]  
06/23/20 22:33:43   SMTP-IN D50DB0BE07584F9484734E4E911EE303.MAI    1104    185.143.75.153  QUIT    QUIT    221 Service closing transmission channel    42  6   [email protected] 
06/23/20 22:33:43   SMTP-IN 09B37BA353F34F3EA5A98E682F9E963C.MAI    1120    212.70.149.18   QUIT    QUIT    221 Service closing transmission channel    42  6   [email protected]  
06/23/20 22:33:45   SMTP-IN CA6566ED0D5C4CF4BC9EA6A1A5AC988B.MAI    1068    185.143.75.81           220 mail.example.com ESMTP MailEnable Service, Version: 7.59-7.59- ready at 06/23/20 22:33:45   0   0       
06/23/20 22:33:46   SMTP-IN CA6566ED0D5C4CF4BC9EA6A1A5AC988B.MAI    1068    185.143.75.81   EHLO    EHLO User   250-example.com [185.143.75.81], this server offers 5 extensions    143 11      
06/23/20 22:33:47   SMTP-IN CA6566ED0D5C4CF4BC9EA6A1A5AC988B.MAI    1068    185.143.75.81   RSET    RSET    250 Requested mail action okay, completed   43  6       
06/23/20 22:33:48   SMTP-IN CA6566ED0D5C4CF4BC9EA6A1A5AC988B.MAI    1068    185.143.75.81   AUTH    AUTH LOGIN  334 VXNlcm5hbWU6    18  12      
06/23/20 22:33:49   SMTP-IN CA6566ED0D5C4CF4BC9EA6A1A5AC988B.MAI    1068    185.143.75.81   AUTH    {blank} 334 UGFzc3dvcmQ6    18  38  [email protected] 
06/23/20 22:33:50   SMTP-IN CB468621E3BC48089B6A50F14530F7F9.MAI    1136    212.70.149.2            220 mail.example.com ESMTP MailEnable Service, Version: 7.59-7.59- ready at 06/23/20 22:33:50   0   0       
06/23/20 22:33:50   SMTP-IN CA6566ED0D5C4CF4BC9EA6A1A5AC988B.MAI    1068    185.143.75.81   AUTH    cEBzc3cwcmQ=    504 Invalid Username or Password    34  14  [email protected] 
06/23/20 22:33:51   SMTP-IN CB468621E3BC48089B6A50F14530F7F9.MAI    1136    212.70.149.2    EHLO    EHLO User   250-example.com [212.70.149.2], this server offers 5 extensions 142 11      
06/23/20 22:33:51   SMTP-IN CA6566ED0D5C4CF4BC9EA6A1A5AC988B.MAI    1068    185.143.75.81   QUIT    QUIT    221 Service closing transmission channel    42  6   [email protected] 
06/23/20 22:33:52   SMTP-IN CB468621E3BC48089B6A50F14530F7F9.MAI    1136    212.70.149.2    RSET    RSET    250 Requested mail action okay, completed   43  6       
06/23/20 22:33:53   SMTP-IN CB468621E3BC48089B6A50F14530F7F9.MAI    1136    212.70.149.2    AUTH    AUTH LOGIN  334 VXNlcm5hbWU6    18  12      
06/23/20 22:33:54   SMTP-IN B4699D1493B74E85A8671850B09F08D3.MAI    1112    185.143.72.25           220 mail.example.com ESMTP MailEnable Service, Version: 7.59-7.59- ready at 06/23/20 22:33:54   0   0       
06/23/20 22:33:54   SMTP-IN CB468621E3BC48089B6A50F14530F7F9.MAI    1136    212.70.149.2    AUTH    {blank} 334 UGFzc3dvcmQ6    18  34  [email protected]    
06/23/20 22:33:55   SMTP-IN CB468621E3BC48089B6A50F14530F7F9.MAI    1136    212.70.149.2    AUTH    ZWRhbWFtdXI=    504 Invalid Username or Password    34  14  [email protected]    
06/23/20 22:33:55   SMTP-IN B4699D1493B74E85A8671850B09F08D3.MAI    1112    185.143.72.25   EHLO    EHLO User   250-example.com [185.143.72.25], this server offers 5 extensions    143 11      
06/23/20 22:33:56   SMTP-IN CB468621E3BC48089B6A50F14530F7F9.MAI    1136    212.70.149.2    QUIT    QUIT    221 Service closing transmission channel    42  6   [email protected]    
06/23/20 22:33:56   SMTP-IN B4699D1493B74E85A8671850B09F08D3.MAI    1112    185.143.72.25   RSET    RSET    250 Requested mail action okay, completed   43  6       
06/23/20 22:33:58   SMTP-IN B4699D1493B74E85A8671850B09F08D3.MAI    1112    185.143.72.25   AUTH    AUTH LOGIN  334 VXNlcm5hbWU6    18  12      
06/23/20 22:33:59   SMTP-IN B4699D1493B74E85A8671850B09F08D3.MAI    1112    185.143.72.25   AUTH    {blank} 334 UGFzc3dvcmQ6    18  26  [email protected]    
06/23/20 22:34:00   SMTP-IN B4699D1493B74E85A8671850B09F08D3.MAI    1112    185.143.72.25   AUTH    MTIzNDU2Nzg=    504 Invalid Username or Password    34  14  [email protected]    
06/23/20 22:34:01   SMTP-IN 9CBF0EE9385B47DE8E869EAFE6CC220D.MAI    1100    212.70.149.50           220 mail.example.com ESMTP MailEnable Service, Version: 7.59-7.59- ready at 06/23/20 22:34:01   0   0       
06/23/20 22:34:01   SMTP-IN B4699D1493B74E85A8671850B09F08D3.MAI    1112    185.143.72.25   QUIT    QUIT    221 Service closing transmission channel    42  6   [email protected]    
06/23/20 22:34:02   SMTP-IN 3FE80CCEAA0942739F26259F1FB15696.MAI    1040    212.60.249.12           220 mail.example.com ESMTP MailEnable Service, Version: 7.59-7.59- ready at 06/23/20 22:34:02   0   0       
06/23/20 22:34:02   SMTP-IN 9CBF0EE9385B47DE8E869EAFE6CC220D.MAI    1100    212.70.149.50   EHLO    EHLO User   250-example.com [212.70.149.50], this server offers 5 extensions    143 11      
06/23/20 22:34:03   SMTP-IN 3FE80CCEAA0942739F26259F1FB15696.MAI    1040    212.60.249.12   EHLO    EHLO User   250-example.com [212.60.249.12], this server offers 5 extensions    143 11      
06/23/20 22:34:04   SMTP-IN 9CBF0EE9385B47DE8E869EAFE6CC220D.MAI    1100    212.70.149.50   RSET    RSET    250 Requested mail action okay, completed   43  6       
06/23/20 22:34:05   SMTP-IN 3FE80CCEAA0942739F26259F1FB15696.MAI    1040    212.60.249.12   RSET    RSET    250 Requested mail action okay, completed   43  6       
06/23/20 22:34:05   SMTP-IN 9CBF0EE9385B47DE8E869EAFE6CC220D.MAI    1100    212.70.149.50   AUTH    AUTH LOGIN  334 VXNlcm5hbWU6    18  12      
06/23/20 22:34:06   SMTP-IN 3FE80CCEAA0942739F26259F1FB15696.MAI    1040    212.60.249.12   AUTH    AUTH LOGIN  334 VXNlcm5hbWU6    18  12      
06/23/20 22:34:07   SMTP-IN 9CBF0EE9385B47DE8E869EAFE6CC220D.MAI    1100    212.70.149.50   AUTH    {blank} 334 UGFzc3dvcmQ6    18  22  [email protected]   
06/23/20 22:34:08   SMTP-IN 3FE80CCEAA0942739F26259F1FB15696.MAI    1040    212.60.249.12   AUTH    {blank} 334 UGFzc3dvcmQ6    18  30  [email protected]  
06/23/20 22:34:08   SMTP-IN 9CBF0EE9385B47DE8E869EAFE6CC220D.MAI    1100    212.70.149.50   AUTH    UEBzc3cwcmQ=    504 Invalid Username or Password    34  14  [email protected]   
[06/23/20 22:34:09]****************** LOG FILE CLOSED ********************

我错过了什么?

更新 1

好的,我禁用了对入站端口 587 的要求 SSL,并在常规设置选项卡上选中了启用 TLS

然而,我缺少一个复选框Allow clients to establish secure sessions via STARTTLS,正如所见这里

EnableSsl当我设置为时,邮件就会发送false

现在。然而,当我尝试从[电子邮件保护]通过 smtp.example.com

Bad sequence of commands. The server response was: This mail server requires authentication when attempting to send to a non-local e-mail address. Please check your mail client settings or contact your administrator to verify that the domain or address is defined for this server.

我尝试使用相同的凭据[电子邮件保护],但这些都不起作用。我应该在某处配置不同的凭据吗?

更新2 已升级并检查Allow clients to establish secure sessions via STARTTLS。然而,在最新的 MailEnable 版本中,[常规] 选项卡上不再有设置Enable TLS。我仍然收到错误:

命令序列错误。服务器响应为:此邮件服务器在尝试向非本地电子邮件地址发送邮件时需要身份验证。请检查您的邮件客户端设置或联系您的管理员以验证此服务器是否定义了域或地址。

我尝试过localhost不使用任何凭证发送(该电子邮件有效)和smtp.example.com使用凭证发送,但都失败了。我认为我需要通过发送,smtp.example.com因为我有该域的 SSL 证书,而当我通过发送时,localhost我需要我的 VPS 服务器域的 SSL 证书648gfhur343.stratserver.net,这是不可能的(因为通过 Let's Encrypt 颁发,问题不同)。

SMTP 日志

[06/27/20 14:17:27]****************** LOG FILE STARTED *******************
06/27/20 14:17:29   SMTP-IN A7DFBF7F65344DCD86F1FE13AC92DD20.MAI    844 212.60.249.12           220 mail.example.com ESMTP MailEnable Service, Version: 10.30-- ready at 06/27/20 14:17:29  94  0       
06/27/20 14:17:30   SMTP-IN 21CF95A9113A47B581E1F0C4FDEB146A.MAI    840 85.214.200.31           220 mail.example.com ESMTP MailEnable Service, Version: 10.30-- ready at 06/27/20 14:17:30  94  0       
06/27/20 14:17:30   SMTP-IN 21CF95A9113A47B581E1F0C4FDEB146A.MAI    840 85.214.200.31   EHLO    EHLO h2746286   250-example.com [85.214.200.30], this server offers 5 extensions    237 15      
06/27/20 14:17:30   SMTP-IN 21CF95A9113A47B581E1F0C4FDEB146A.MAI    840 85.214.200.31   MAIL    MAIL FROM:<[email protected]>    250 Requested mail action okay, completed   43  34      
06/27/20 14:17:30   SMTP-IN 21CF95A9113A47B581E1F0C4FDEB146A.MAI    840 85.214.200.31   RCPT    RCPT TO:<[email protected]>  503 This mail server requires authentication when attempting to send to a non-local e-mail address. Please check your mail client settings or contact your administrator to verify that the domain or address is defined for this server.   235 33      
[06/27/20 14:17:36]****************** LOG FILE CLOSED ********************

截图设置

在此处输入图片描述 在此处输入图片描述 在此处输入图片描述 在此处输入图片描述 在此处输入图片描述 错误

答案1

EnableSsl 实际上不使用 SSL 连接到邮件服务器,而是不使用 SSL 进行连接并使用 STARTTLS 命令进行安全通信。您需要选中“启用 TLS”复选框,这样服务才能支持 STARTTLS 命令,但要关闭 587 端口配置的“需要 SSL”(或者在未使用 SSL 的情况下使用端口 25)。

相关内容