NetMailAddress.Create

Syntax

Create(Address: String);

Parameters

Address. Email address.

NOTE. Email address format must correspond to the address format used in email organization based on the SMTP and POP protocols and must be of the following form: address@mail_domain where address - recipient identifier, and mail_domain - mail server domain name. Example: user@mail.ru.

Description

The Create constructor creates an email address object.

Example

Sub Main;

Var

From_, To_: INetMailAddress;

Message: INetMailMessage;

Client: INetSmtpClient;

Begin

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

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

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

Message.Subject := "Test message";

Message.Body := "Message text is specified here";

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

Client.Send(Message);

End Sub Main;

After executing the example a 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).

See also:

NetMailAddress