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

Declaration
property OnHostUnrachable: TNotifyEvent;  

Description
The OnHostUnreachable event occurs if the SendMail can not establish connection to SMTP server, specified in SMTPHost property. Possible reasons of this problem is:  
1.User currently not connected to the Internet;  
2.Hostname is unknown (check spelling of domain name in SMTPHost property);  
3.Invalid SMTP port specified (check the number of SMTP port in SMTPPort property);  
4.Remote server is down (disconnected from Internet).  

Example
Delphi:
procedure TForm1.SendMail1HostUnreachable(Sender: TObject);  
begin  
  Application.MessageBox(PChar('Specified SMTP server is unreachable.'#13#10#10'Please check your Internet connection'#13#10'or specify another SMTP host or/and port.'),  
                         PChar(Application.Title),  
                         MB_OK or MB_ICONSTOP);  
end;  
 
C++ Builder:
void __fastcall TForm1::SendMail1HostUnreachable(TObject *Sender)  
{  
  AnsiString Msg =   
      "Specified SMTP server is unreachable.\n\n"  
      "Please check your Internet connection\n"  
      "or specify another SMTP host or/and port.";  
  Application->MessageBox(Msg.c_str(),   
                          Application->Title.c_str(),  
                          MB_OK | MB_ICONSTOP);  
}  

See also
SMTPHost and SMTPPort properties;  
OnAnyError event.