CreateWithHostAndPort(Host: String; Port: Integer);
Host - mail server name or IP address.
Port - port that provides access to mail server.
The CreateWithHostAndPort constructor creates an object that provides for email message sending.
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.
Sub SendMailMessage(Server: String; Port: Integer);
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", 8080);
Client.Send(Message);
End Sub SendMailMessage;
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: