Il codice sottostante sembra assolutamente corretto, eppure restituisce un errore "Impossibile inviare il messaggio al server SMTP. Codice errore di trasporto: 0x80040217. Risposta del server: not available". Non esiste smtp.gmail.com ?
Dove sbaglio ?
Grazie per l'attenzione.

codice:
Dim imsg As Object
   Dim iconf As Object
   Dim flds As Variant
   Dim schema As Variant
   
   On Error GoTo ErrorTrap
   Set imsg = CreateObject("CDO.Message")
   Set iconf = CreateObject("CDO.Configuration")
   Set flds = iconf.Fields
   schema = "http://schemas.microsoft.com/cdo/configuration/"
   flds.Item(schema & "sendusing") = 2
   flds.Item(schema & "smtpserver") = "smtp.gmail.com"
   flds.Item(schema & "smtpserverport") = 465
   flds.Item(schema & "smtpauthenticate") = 1
   flds.Item(schema & "sendusername") = EmailMittente
   flds.Item(schema & "sendpassword") = PasswordMittente
   flds.Item(schema & "smtpconnectiontimeout") = 100
   flds.Item(schema & "smtpusessl") = 1
   flds.Update
   With imsg
      .To = MailDestinatario
      .From = EmailMittente
      .Sender = "Servizi srl"
      .Subject = Oggetto
      .HTMLBody = CorpoMessaggio
      Set .Configuration = iconf
      On Error Resume Next
      InviaMail = .Send
      If Err.Number <> 0 Then
          TxLog = TxLog + "Invio email FALLITA a " + RagioneSociale + " (" + MailDestinatario + ") errore " + CStr(Err.Number) + vbCrLf
      Else
          TxLog = TxLog + "Invio email a " + RagioneSociale + " (" + MailDestinatario + ")" + vbCrLf
      End If
      On Error GoTo 0
   End With