eMail via Google funzt nicht mehr!
27.11.2021 11:17:12
Alf16
seit Jahren versende ich eMails aus Excel via Google-Mail mit dem u. a. Code. Seit einiger Zeit zickt er dabei immer und ich muss in den Google-Einstellungen den IMAP-Zugriff, sowie die POP aktivieren. Das hat eine Weile geklappt, aber nun hilft auch das plötzlich nicht mehr und er bleibt immer bei ".send" hängen. Ich habe schon das Passwort geändert und mit verschiedenen Serverports (25, 587) getestet. Ohne Erfolg. Habt ihr evtl. eine Idee, woran das liegen könnte?
Vielen Dank im Voraus.
Gruß Alf
Sub eMail_via_GMail()
Dim iMsg As Object, iConf As Object, strbody As String, Flds As Variant
Set iMsg = CreateObject("CDO.Message")
Set iConf = CreateObject("CDO.Configuration")
iConf.Load -1
Set Flds = iConf.Fields
With Flds
.Item("http://schemas.microsoft.com/cdo/configuration/smtpusessl") = True
.Item("http://schemas.microsoft.com/cdo/configuration/smtpauthenticate") = 1
.Item("http://schemas.microsoft.com/cdo/configuration/sendusername") = "email"
.Item("http://schemas.microsoft.com/cdo/configuration/sendpassword") = "pw"
.Item("http://schemas.microsoft.com/cdo/configuration/smtpserver") = "smtp.gmail.com"
.Item("http://schemas.microsoft.com/cdo/configuration/sendusing") = 2
.Item("http://schemas.microsoft.com/cdo/configuration/smtpserverport") = 25
.Update
End With
strbody = "Text"
With iMsg
Set .Configuration = iConf
.To = "email"
.Subject = "Subject"
.From = """MyName"" "
.TextBody = strbody
.Send
End With
Set iConf = Nothing
Set iMsg = Nothing
End Sub