INetMailMessage.Sender

Syntax

Sender: INetMailAddress;

Description

The Sender property determines the address, to which the email server notification is sent in case of message delivery failure.

Comments

If the property value is not set, by default the notification is sent to the sender address.

Example

Sub Main;

Var

SenderAdress, From_, To_: INetMailAddress;

Message: INetMailMessage;

Client: INetSmtpClient;

Begin

From_ := New NetMailAddress.Create("ivanov@server.ru");

To_ := New NetMailAddress.Create("123@mail.ru");

SenderAdress := New NetMailAddress.Create("admin1@mail.ru");

Message := New NetMailMessage.CreateWithFromAndTo(From_, To_);

Message.Subject := "Test message";

Message.Body := "Message text";

Message.Sender := SenderAdress;

Client := New NetSmtpClient.CreateWithHost("example.server.ru");

Client.Send(Message);

End Sub Main;

After executing the example the message is sent via the specified mail server "123@mail.ru". In case of delivery failure the corresponding notification is sent to the admin1@mail.ru address from the mail server.

See also:

INetMailMessage