| Author | 
         | 
         
      
        
         
         Nishant Newbie 
          
  
  Joined: 04 March 2009 Location: India
 Online Status: Offline Posts: 5
          | 
        
         
          
           | Posted: 04 March 2009 at 11:31pm | IP Logged
		     | 
                    
            		  
           | 
           
          
           
  | 
           
          
I want to check for SMTP connectivity. How can I check it without sending any mail?
         | 
       
       
        | Back to Top | 
         
          
         | 
       
       
       
        |   | 
      
        
         
         Igor AfterLogic Support 
          
 
  Joined: 24 June 2008 Location: United States
 Online Status: Offline Posts: 6168
          | 
        
         
          
           | Posted: 05 March 2009 at 1:07am | IP Logged
		     | 
                    
            		  
           | 
           
          
           
  | 
           
          
You can connect to SMTP server and disconnect from it without sending data as follows:
 
 
Code: 
   
    
    
      
       Dim Mailer
 Set Mailer = CreateObject("MailBee.SMTP")
 Mailer.LicenseKey = "put your license key here"
 Mailer.ServerName = "mail.server.com"
 Mailer.UserName = "MyName"
 Mailer.Password = "MyPassword"
 Mailer.AuthMethod = 1 ' PLAIN ESMTP authentication
 If Mailer.Connect Then
   MsgBox "Connected successfully"
   Mailer.Disconnect
 Else
   ' Server not available, PLAIN is not supported or username/password is incorrect
   MsgBox Mailer.ErrDesc 
 End If
  | 
       
       | 
    
    | 
 
 
 
 Regards,
 Igor
         | 
       
       
        | Back to Top | 
         
          
         | 
       
       
       
        |   | 
      
        
         
         Nishant Newbie 
          
  
  Joined: 04 March 2009 Location: India
 Online Status: Offline Posts: 5
          | 
        
         
          
           | Posted: 05 March 2009 at 2:34am | IP Logged
		     | 
                    
            		  
           | 
           
          
           
  | 
           
          
Thanks a lot. It worked fine. I am not using PLAIN. After commenting Mailer.AuthMethod = 1 line. I am getting "Connected successfully" in spite of providing wrong user name and password.  
         | 
       
       
        | Back to Top | 
         
          
         | 
       
       
       
        |   | 
      
        
         
         Nishant Newbie 
          
  
  Joined: 04 March 2009 Location: India
 Online Status: Offline Posts: 5
          | 
        
         
          
           | Posted: 05 March 2009 at 2:46am | IP Logged
		     | 
                    
            		  
           | 
           
          
           
  | 
           
          
I got it. If we need to test username and password also. we should use Mailer.AuthMethod = 2      
         | 
       
       
        | Back to Top | 
         
          
         | 
       
       
       
        |   |