MailBee.NET Objects 3.1

MailMessage.ReturnPath Property

Gets the value of Return-Path header.

public string ReturnPath {get;}

Property Value

A string containing the e-mail address of the actual sender of the message. The default value is an empty string.

Remarks

The mail server which transmitted the message may add this header to specify the email address of the original sender of the mail message. If the message was never sent, this property will contain an empty string. With TimeStamps property (which represents Received headers), ReturnPath provides trace route information about the message.

You cannot set ReturnPath directly (because it's set by the mail server, not by MailBee). However, if you need to send a message from the address different from From address, you can pass it as senderEmail parameter value of Send method. In this case, the mail server will set Return-Path header to senderEmail value, not to From value.

Example

This sample loads the message from .EML file and displays the email address of the originator of this message.

[C#]
// To use the code below, import MailBee namespaces at the top of your code.
using MailBee;
using MailBee.Mime;

// The actual code (put it into a method of your class)

// Load the message from file.
MailMessage msg = new MailMessage();
msg.LoadMessage(@"C:\Docs\TestMail.eml");

// Show the return path of the message.
Console.WriteLine("The return path is " + msg.ReturnPath);        
[Visual Basic]
' To use the code below, import MailBee namespaces at the top of your code.
Imports MailBee
Imports MailBee.Mime

' The actual code (put it into a method of your class)

' Load the message from file.
Dim msg As New MailMessage
msg.LoadMessage("C:\Docs\TestMail.eml")

' Show the return path of the message.
Console.WriteLine("The return path is " & msg.ReturnPath)        

See Also

MailMessage Class | MailBee.Mime Namespace | TimeStamps