MailBee.NET Objects 3.1

MailMessage.ReplyTo Property

Gets or sets the list of the e-mail addresses where to send a reply to this message.

public EmailAddressCollection ReplyTo {get; set;}

Property Value

A reference to the collection of e-mail addresses which are intended recipients of a reply to this message. The default value is an empty collection.

Remarks

To specify it as a string, set msg.ReplyTo.AsString value (assuming msg is MailMessage instance).

This value is obtained from Reply-To header of the message. If you need to reply to a message which does not contain Reply-To header, send the reply to From address.

Exceptions

Exception TypeCondition
MailBeeInvalidArgumentExceptionvalue is a null reference (Nothing in Visual Basic).

Example

This sample gets a message from POP3 server and sends autoresponse to its Reply-To address.

[C#]
using MailBee;
using MailBee.SmtpMail;
using MailBee.Pop3Mail;
using MailBee.Mime;

class Sample
{
    static void Main(string[] args)
    {
        // Download the first mail message from the specified POP3 account.
        MailMessage msg = Pop3.QuickDownloadMessage("mail.company.com", "bill", "password", 1);

        // Send the autoresponse message.
        Smtp.QuickSend("bill@company.com", msg.ReplyTo.ToString(), "Warning notification",
            "Since I'm currently on vacations, I'll reply your message after 01/08/06.");
    }
}
[Visual Basic]
Imports MailBee
Imports MailBee.Pop3Mail
Imports MailBee.SmtpMail
Imports MailBee.Mime

Module Sample
    Sub Main(ByVal args As String())
        ' Download the first mail message from the specified POP3 account.
        Dim msg As MailMessage = Pop3.QuickDownloadMessage("mail.company.com", "bill", "password", 1)

        ' Send the autoresponse message.
        Smtp.QuickSend("bill@company.com", msg.ReplyTo.ToString, "Warning notification", _
            "Since I'm currently on vacations, I'll reply your message after 01/08/06.")
    End Sub
End Module

See Also

MailMessage Class | MailBee.Mime Namespace | ConfirmReceipt