Send(Message: INetMailMessage);
Message. Email message that must be sent.
The Send method sends an email message.
A message is sent via the mail server specified on initializing in the CurlSmtpClient.CreateWithHost or CurlSmtpClient.CreateWithHostAndPort constructor, or to the server determined in the INetSmtpClient.Host property. Messages are sent taking into account the parameters set in the INetSmtpClient.Port and INetSmtpClient.Timeout properties.
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.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: