MailMessageReturnPath Property
Gets the value of Return-Path header.

Namespace: MailBee.Mime
Assembly: MailBee.NET (in MailBee.NET.dll) Version: 12.2.0 build 630 for .NET 4.5
public string ReturnPath { get; }

Property Value

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

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(String, String) method. In this case, the mail server will set Return-Path header to senderEmail value, not to From value.

This sample loads the message from .EML file and displays the email address of the originator of this message.
// 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();

// Show the return path of the message.
Console.WriteLine("The return path is " + msg.ReturnPath);
See Also