我正在使用下面的代码尝试使用VBA在Excel中发送电子邮件。 我不断收到错误: 运行时错误“-2147220973(80040213)”:传输失败连接到服务器。 我尝试更改端口(25,465,587),更改电子邮件服务器(smtp.gmail.com,smtp.live.com),同时尝试Gmail和Hotmail,在两个Gmail帐户启用不太安全,甚至设置Outlook和禁用防火墙在Avast。 代码如下: Sub CDO_Mail_Small_Text() Dim iMsg As Object Dim iConf As Object Dim strbody As String Dim Flds As Variant Set iMsg = CreateObject("CDO.Message") Set iConf = CreateObject("CDO.Configuration") iConf.Load -1 ' CDO Source Defaults Set Flds = iConf.Fields With Flds .Item("http://schemas.microsoft.com/cdo/configuration/sendusing") = 2 .Item("http://schemas.microsoft.com/cdo/configuration/smtpserver") = "smtp.gmail.com" .Item("http://schemas.microsoft.com/cdo/configuration/smtpserverport") = 465 '587 '465 '25 […]