property OnError: TMailErrorEvent
L'événement OnError
se déclenche en cas d'erreur lors de l'envoi du mail.
procedure TForm1.Mailer1Error(Sender: TMailer; Error: Cardinal; const Msg: string); var Str: string; begin case Error of SOCKET_ERROR_DNS : Str := 'Unknow host ' + Msg; SOCKET_ERROR_HANDLE : Str := 'Socket error: ' + Msg; SOCKET_ERROR_CONNECT : Str := 'Unable to connect: ' + Msg; SOCKET_ERROR_RECV : Str := 'Recv error: ' + Msg; SOCKET_ERROR_SEND : Str := 'Send error: ' + Msg; SMTP_ERROR_AUTHENTICATE : Str := 'Authentication failed: ' + Msg; SMTP_ERROR_MESSAGE : Str := 'SMTP Error : ' + Msg; SMTP_ERROR_NO_RECIPIENT : Str := Msg; SMTP_ERROR_REJECTED : Str := Msg; SMTP_ERROR_PROTOCOL : Str := 'SMTP protocol error: ' + Msg; else Str := Format('Error #%.8x : %s', [Error, Msg]); end; ShowMessage(Str); end;