sendmail OnSMTPError event
Return to Introduction  Previous page  Next page
Applies to
SendMail component.  

Declaration
type  
  TSMTPResponseEvent = procedure(Sender: TObject; Code: Integer; const Response: Stringof object;  
 
property OnSMTPError: TSMTPResponseEvent;  

Description
The OnSMTPError event occurs when the SMTP server returns an error code with response (see OnResponse event). After receiving error code, the SendMail component automatically terminates connection with SMTP server, then triggers the OnSMTPError event.  
 
For more information about status codes of SMTP protocol see RFC 821.  

Example
procedure TForm1.SendMail1SMTPError(Sender: TObject;  
  Code: Integer; const Response: string);  
begin  
  with StatusList do  
   begin  
    Items.Add('ERROR: ' + Response);  
    ItemIndex := Items.Count - 1;  
   end;  
end;  

See also
OnResponse and OnAnyError events.