EnableSsl: Boolean;
The EnableSsl property determines whether SSL encryption is required to send messages via external mail servers.
Use the INetSmtpClient.Port property to determine the port, via which emails are sent.
Available values:
True. SSL encryption is used.
False. SSL encryption is not used.
To execute the example, add a link to the Net system assembly.
Sub UserProc;
Var
From_, To_: INetMailAddress;
Message: INetMailMessage;
Client: INetSmtpClient;
Credential: INetNetworkCredential;
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 text";
Client := New NetSmtpClient.CreateWithHost("example.server.ru");
Credential := New NetNetworkCredential.Create("user", "password", "work");
Client.ThisHostCredentials("") := Credential;
Client.EnableSsl := True;
Client.Send(Message);
End Sub UserProc;
This procedure enables the user to send emails via the specified mail server. The specified account credentials will be used for authorization in the mail server.
See also: