【发布时间】:2020-06-25 15:37:27
【问题描述】:
我正在代表共享邮箱 - 通用系统帐户发送电子邮件?
如何更新 Outlook 邮件中的发件人?
我收到运行时错误“438”:对象不支持此属性或方法。From = "MYACCOUNT@ACCOUNT.com"
Function CreateEmail(MySQL As String)
'On Error GoTo Exit_Function:
Dim oOutlook As Outlook.Application
Dim oEmailItem As MailItem 'rs As Recordset
Dim rs As Recordset
Set rs = CurrentDb.OpenRecordset(MySQL)
If rs.RecordCount > 0 Then
rs.MoveFirst
Do Until rs.EOF
If IsNull(rs!standard_e_mail_addr) Then
rs.MoveNext
Else
If oOutlook Is Nothing Then
Set oOutlook = New Outlook.Application
End If
Set oEmailItem = oOutlook.CreateItem(olMailItem)
With oEmailItem
.To = rs!standard_e_mail_addr
.From = "MYACCOUNT@ACCOUNT.com" ' **
.Subject = "Mandatory Action Required Submit In-Person Identification Form for " & rs!emp_fname
.Body = "EmpNo: " & rs!emp_no & vbCr & _
"EmpName: " & rs!emp_fname & vbCr & _
"DO NOT REPLY."
.Display
.Send
rs.Edit
rs!EmailNotification_Send = Date
rs.Update
End With
Set oEmailItem = Nothing
Set oOutlook = Nothing
rs.MoveNext
End If
Loop
Else
End If
rs.Close
Exit Function:
Exit Function
End Function
【问题讨论】:
-
您需要在帖子中添加一些叙述并修复代码格式。我试过了,它不会让我。但实际上,问题是什么?使用您想要的任何电子邮件地址代替“MYACCOUNT@ACCOUNT.com”。
-
我收到运行时错误“438”:对象不支持此属性或方法。From = "MYACCOUNT@ACCOUNT.com"
-
见stackoverflow.com/questions/26427302/…、stackoverflow.com/questions/33322540/change-the-from-field、stackoverflow.com/questions/26432256/…。如果您在其中任何一个问题中找到答案,请考虑删除您的问题,因为该网站力求一个问题不重复。