NetSmtpClient.CreateWithHost

Syntax

CreateWithHost(Host: String);

Parameters

Host is the mail server name or the IP address.

Description

The CreateWithHost designer creates an object, that provides the email messages sending.

Comments

The name or the IP address of the mail server passed by the Host parameter, the server is used for message sending.

Example

Sub SendMailMessage(Server: String);

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 letter";

Message.Body := "Letter body";

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

Client.Send(Message);

End Sub SendMailMessage;

The procedure can be used for sending email messages via a specified mail server. The name or the IP address of the mail server is specified in the Server procedure parameter.

See also:

NetSmtpClient