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. Add the trusted root certificate in the PEM format:
In Linux OS execute one of the operations:
Add certificate contents to the /etc/ssl/certs/ca-certificates.crt file.
Add a certificate with the *.pem extension to the /etc/ssl/certs folder.
In Windows OS:
Run the Microsoft Management Console built-in utility.
Add a certificate to the Trusted Root Certification Authorities > Certificates folder.
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 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.CreateWithHost("example.server.ru");
Credential := New CurlNetworkCredential.Create("user", "password", "work");
Client.ThisHostCredentials("") := Credential;
Client.EnableSsl := True;
Client.Send(Message);
End Sub UserProc;
The specified procedure enables the user to send emails via the specified mail server. The specified credentials are used for authorization at the mail server.
See also: