如何更新发送者电子邮件address



我代表共享邮箱发送电子邮件 - 通用系统帐户?

如何在Outlook Mail中更新发件人?

我正在遇到运行时错误'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

好吧,尝试: .SentOnBehalfOfName = """SenderName"" <MyAccount@Address.com>"

还评论:使用另一个帐户

首先,在调用Send方法之前,无需调用Display

如果您需要在Outlook中配置的共享邮箱,则需要使用sendusingAccount属性,该属性允许设置一个代表邮件列表的帐户的Account对象。例如:

Sub SendUsingAccount() 
  Dim oAccount As Outlook.account  
  For Each oAccount In Application.Session.Accounts  
    If oAccount.AccountType = olPop3 Then  
      Dim oMail As Outlook.MailItem  
      Set oMail = Application.CreateItem(olMailItem)  
      oMail.Subject = "Sent using POP3 Account"  
      oMail.Recipients.Add ("someone@example.com")  
      oMail.Recipients.ResolveAll  
      oMail.SendUsingAccount = oAccount  
      oMail.Send  
    End If  
  Next  
End Sub 

使用SentonBehalfoFname,只要您的Exchange帐户拥有共享邮箱或分销组的Sendas许可,它将从共享帐户或组发送,而不是代表。

    With oEmailItem
        .To = rs!standard_e_mail_addr
        .SentOnBehalfOfName = "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."
        .Send

最新更新