NetSmtpClient.CreateWithHost

Syntax

CreateWithHost(Host: String);

Parameters

Host. Mail server name or IP address.

Description

The CreateWithHost constructor creates an object that provides for email message sending.

Comments

The name or the IP address of the mail server, via which messages are sent, is passed by the Host parameter.

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

Message.Body := "Message text";

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

Client.Send(Message);

End Sub SendMailMessage;

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

See also:

NetSmtpClient