0

How can I get a response that I have successfully logged on without sending email?

try
{
    var client = new SmtpClient();
    client.EnableSsl = true;
    client.UseDefaultCredentials = false;
    client.Host = "smtp.gmail.com";
    client.Port = 587;
    client.Credentials = new NetworkCredential(email, pw);

}
catch (Exception e)
{
    Console.WriteLine(e.Message);
    Console.ReadKey();
}

with:

using System.Net;
using System.Net.Mail;

But this gives my neither a correct response nor an error when I change from correct to incorrect password. How can I get a log on response? or do I have to send a test email to test connection? Can you really only establish connection with:

client.send(...);
nik
  • 1,672
  • 2
  • 17
  • 36
  • 1
    "my neither a correct response" Which response? I don't see one... You should elaborate. – spender Jan 21 '15 at 13:20
  • Sorry! but that is exactly my question. how do I get a response? If i change my pw I dont get error either, so at what point do I establish the connection? only with client.send()? is there another way to establish connection – nik Jan 21 '15 at 13:22
  • 1
    possible duplicate of [Can I test SmtpClient before calling client.Send()?](http://stackoverflow.com/questions/372742/can-i-test-smtpclient-before-calling-client-send) – Hugo Delsing Jan 21 '15 at 13:33

0 Answers0