Unlock a world of possibilities! Login now and discover the exclusive benefits awaiting you.
Hi ,
I am getting error "The message could not be sent to the SMTP server. The transport error code was 0x80040217. The server response was not available " on code line objMsg.Send
Please help me
thanks,
Kapil
Sub SendGMail1()
' Object creation
Set objMsg = CreateObject("CDO.Message")
Set msgConf = CreateObject("CDO.Configuration")
' Server Configuration
msgConf.Fields.Item("http://schemas.microsoft.com/cdo/configuration/sendusing") = 2
msgConf.Fields.Item("http://schemas.microsoft.com/cdo/configuration/smtpserver") = "smtp.gmail.com"
msgConf.Fields.Item("http://schemas.microsoft.com/cdo/configuration/smtpserverport") = 465
msgConf.Fields.Item("http://schemas.microsoft.com/cdo/configuration/smtpauthenticate") = 1
msgConf.Fields.Item("http://schemas.microsoft.com/cdo/configuration/sendusername") = "kapil_dadheech@gmail.com"
msgConf.Fields.Item("http://schemas.microsoft.com/cdo/configuration/sendpassword") = "kapil1"
msgConf.Fields.Item("http://schemas.microsoft.com/cdo/configuration/smtpusessl") = 1
msgConf.Fields.Update
' Email
objMsg.To = "kapil_dadheech@gmail.com"
objMsg.From = "kapil_dadheech@gmail.com"
objMsg.Subject = "Test send with Gmail account"
objMsg.HTMLBody = "HTML/Plain text message."
objMsg.Sender = "Mr. Name"
Set objMsg.Configuration = msgConf
' Send
objMsg.Send
' Clear
Set objMsg = nothing
Set msgConf = nothing
End Sub
Hi, the macro is ok,but the server smt does not allow to send mail
1) try change the port , put 25 instead of 465
2) do a telnet to check the send of the smpt server
this macro works ok
Sub SendGMail()
MsgBox "Reporte Generado Correctamente"
Set objMsg = CreateObject("CDO.Message")
Set msgConf = CreateObject("CDO.Configuration")
'Server Configuration
msgConf.Fields.Item("http://schemas.microsoft.com/cdo/configuration/sendusing") = 2
msgConf.Fields.Item("http://schemas.microsoft.com/cdo/configuration/smtpserver") = "smtp.gmail.com"
msgConf.Fields.Item("http://schemas.microsoft.com/cdo/configuration/smtpserverport") = 25
msgConf.Fields.Item("http://schemas.microsoft.com/cdo/configuration/smtpauthenticate") = 1
msgConf.Fields.Item("http://schemas.microsoft.com/cdo/configuration/sendusername") = "xxxxx" 'type your mail id
msgConf.Fields.Item("http://schemas.microsoft.com/cdo/configuration/sendpassword") = "xxxxx" 'Type your acccount Password
msgConf.Fields.Item("http://schemas.microsoft.com/cdo/configuration/smtpusessl") = 1
msgConf.Fields.Update
objMsg.To = "user@gmail.com" ' type to mail id
objMsg.From = "user@gmail.com" 'type from mail id
objMsg.Subject = "Test mail"
objMsg.HTMLBody = "Reporte de Ventas y Objetivos"
objMsg.Sender = "Dpto. Sistemas"
Set objMsg.Configuration = msgConf
objMsg.Send
Msgbox("Email enviado correctamente")
Set objMsg = nothing
Set msgConf = nothing
End Sub