Email Versand cdo
25.03.2019 12:55:29
Leo
Public Function EmailVersand()
Dim OutMail As Object
Dim Schema As String
Const cdoSendUsingPort = 2 ' send the message using the network (SMTP over the network)
Const cdoAnonymous = 0 ' do not authenticate
Const cdoBasic = 1 ' use basic (clear-text) authentication
Set OutMail = CreateObject("CDO.Message")
Schema = "http://schemas.microsoft.com/cdo/configuration/"
With OutMail
.From = "XXX@posteo.de"
.To = "xxx@xxx.at"
.Subject = "test"
.BodyPart.Charset = "iso-8859-1"
.TextBody = "Guten Tag, dies ist ein Test."
With .Configuration.Fields
.Item(Schema & "smtpauthenticate") = cdoBasic
.Item(Schema & "sendusername") = "XXXXX@posteo.de"
.Item(Schema & "sendpassword") = "XXXXX"
.Item(Schema & "sendusing") = cdoSendUsingPort
.Item(Schema & "smtpserver") = "posteo.de"
.Item(Schema & "smtpserverport") = 25
.Item(Schema & "smtpauthenticate") = cdoAnonymous
.Item(Schema & "smtpusessl") = True
.Update
End With
.Send
End With
Set OutMail = Nothing
Exit Function
End Function
Leider kommt beim Testen immer diese Fehlermeldung:
Laufzeitfehler '-2147220977 (8004020f)':
Der Server hat eine oder mehrere Empfling,eradressen zurückgewiesen. Die
Serverantwort lautet: 554 5.7.1 xxx@xxx.at [hier steht die empfängeradresse genannt] : _
_
Relay access
denied
(überall wo xxx steht, stehen natürlich reale Mailadressen drinnen)Kann mir da jemand helfen?
Vielen Dank im Voraus und liebe Grüße,
Leo