MailItem.SenderName Property (Outlook)

Office 2013 and later
GitHub-Mark-64px

Contribute to this content

Use GitHub to suggest and submit changes. See our guidelines for contributing to VBA documentation.

Returns a String indicating the display name of the sender for the Outlook item. Read-only.

expression .SenderName

expression A variable that represents a MailItem object.

This property corresponds to the MAPI property PidTagSenderName.

If you wish to retrieve the fully qualified e-mail address of the sender, use the SenderEmailAddress property.

This Visual Basic for Applications (VBA) example checks if the item displayed in the topmost inspector is sent by 'Dan Wilson' with 'High' importance. If it is, then it displays a message box to the user. Before running this example, replace 'Dan Wilson' with a valid name in your address book.

Sub CheckSenderName 
 
 Dim myItem As Outlook.MailItem 
 
 
 
 Set myItem = Application.ActiveInspector.CurrentItem 
 
 If myItem.Importance = 2 And myItem.SenderName = _ 
 
 "Dan Wilson" Then 
 
 MsgBox "This message is sent by your manager with High importance." 
 
 End If 
 
End Sub
Show: