Sender: INetMailAddress;
The Sender property determines the address, to which the email server notification is sent in case of message delivery failure.
If the property value is not set, by default, the notification is sent to the sender address.
To execute the example, add a link to the Net system assembly.
Sub UserProc;
Var
SenderAdress, From_, To_: INetMailAddress;
Message: INetMailMessage;
Client: INetSmtpClient;
Begin
From_ := New CurlMailAddress.Create("ivanov@server.ru");
To_ := New CurlMailAddress.Create("123@mail.ru");
SenderAdress := New CurlMailAddress.Create("admin1@mail.ru");
Message := New CurlMailMessage.CreateWithFromAndTo(From_, To_);
Message.Subject := "Test message";
Message.Body := "Message text";
Message.Sender := SenderAdress;
Client := New CurlSmtpClient.CreateWithHost("example.server.ru");
Client.Send(Message);
End Sub UserProc;
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: