Returns a String indicating the display name of the sender for the e-mail message, meeting item, or post. This property corresponds to the MAPI property PR_SENDER_NAME. Read-only.
Note If you wish to retrieve the fully qualified e-mail address of the sender, use the SenderEmailAddress property.
Outlook blocks code that attempts to access the SenderName property for security reasons. If you run a third-party add-in, custom solution, or other program that uses the SenderName property in Office Outlook 2003, you may receive the following warning:
A program is trying to automatically send e-mail on your behalf. Do you want to allow this? If this is unexpected, it may be a virus and you should choose "No".
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 myOlApp As Outlook.Application Dim myItem As Outlook.MailItem Set myOlApp = CreateObject("Outlook.Application") Set myItem = myOlApp.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
See Also | Send Method