CreateWithHostAndPort(Host: String; Port: Integer);
None;
Host. Mail server name or IP address.
Port. Port, via which the system accesses mail server.
The CreateWithHostAndPort constructor creates an object that provides for email message sending via the specified port of mail server.
The mail server name or the IP address and the port that provides message sending are passed by the Host and the Port parameters respectively. This method is used if for some reason the message cannot be sent through the mail server standard port.
Add a link to the Net system assembly.
Sub SendMailMessage(Server: String; Port: Integer);
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";
Client := New CurlSmtpClient.CreateWithHostAndPort(Server, Port);
Client.Send(Message);
End Sub SendMailMessage;
None.
This procedure can be used for sending email messages via the specified mail server. The mail server name or IP address and the port, through which the message is sent are specified in the Server and Port procedure parameters.
See also: