CreateWithFromAndTo(From_: INetMailAddress; To_: INetMailAddress);
From_ Sender email address.
To_. Recipient email address.
The CreateWithFromAndTo constructor creates an instance of email message for specified sender and recipient addresses.
Add a link to the Net system assembly.
Sub UserProc;
Var
From_, To_: INetMailAddress;
Message: INetMailMessage;
Client: INetSmtpClient;
Begin
From_ := New CurlMailAddress.Create("ivanov@server.ru");
To_ := New CurlMailAddress.Create("petrov@mail.ru");
Message := New CurlMailMessage.CreateWithFromAndTo(From_, To_);
Message.Subject := "Test message";
Message.Body := "Message text is placed here";
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. For the message sending the two following email addresses are created: From_ - sender address (the email address that must be registered at the mail server); To_ - the address, to which the message must be sent (if this address does not exist, the corresponding notification is sent to the first address).
This example can be started for execution in Linux family operating systems.
See also: