vba - Send Email from Access Program - Stack Overflow

I created a program in Access 2021.When an error occurs the user sends the error to me via the code b

I created a program in Access 2021. When an error occurs the user sends the error to me via the code below (which I got from this site). The code worked fine but the last time it tried to send the email attachment (text file) I got the following error:

" -2147220975: The message could not be sent to SMTP server. The transport error code was 0x80040217. The server response was not available "

I logged on to the outlook email with the username and password (actual not shown below) and had no issues. Can anyone help me figure out what happened?

Set emailObj = CreateObject("CDO.Message")

emailObj.From = "[email protected]"
emailObj.To = "[email protected]"             '[email protected]
emailObj.Subject = "Error Log"
emailObj.TextBody = "From Debbie"
'emailObj.AddAttachment "c:\windows\win.ini"
emailObj.AddAttachment "C:\RDC-POS\Error Logs\ErrorLog.txt"

Set emailConfig = emailObj.Configuration


emailConfig.Fields(";) = 2
emailConfig.Fields(";) = 1
emailConfig.Fields(";) = 
"smtp.office365"
'Exclude the following line
'emailConfig.Fields(";) = 587
emailConfig.Fields(";) = True
emailConfig.Fields(";) = 
     "[email protected]"
emailConfig.Fields(";) = 
    "xxxYY2008"
emailConfig.Fields.Update

emailObj.send

If Err.Number = 0 Then MsgBox "Email has been sent!"
End Sub

发布者:admin,转转请注明出处:http://www.yc00.com/questions/1745256889a4619011.html

相关推荐

  • vba - Send Email from Access Program - Stack Overflow

    I created a program in Access 2021.When an error occurs the user sends the error to me via the code b

    6小时前
    20

发表回复

评论列表(0条)

  • 暂无评论

联系我们

400-800-8888

在线咨询: QQ交谈

邮件:admin@example.com

工作时间:周一至周五,9:30-18:30,节假日休息

关注微信