admin管理员组文章数量:1416631
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
本文标签: vbaSend Email from Access ProgramStack Overflow
版权声明:本文标题:vba - Send Email from Access Program - Stack Overflow 内容由网友自发贡献,该文观点仅代表作者本人, 转载请联系作者并注明出处:http://www.betaflare.com/web/1745256888a2650156.html, 本站仅提供信息存储空间服务,不拥有所有权,不承担相关法律责任。如发现本站有涉嫌抄袭侵权/违法违规的内容,一经查实,本站将立刻删除。
发表评论