I am trying to create a small email tutorial for WPF developers, but I do not want to share it if it has this flagrant error.
This is currently what is happening.
- user types in username and password.
- label 'loginstatus' changes to 'Logged', whether it is gibeerish or not.
- Message object and sending to fields are included.
- the user clicked the "Submit" button, and if there is an exception (for example, an incorrect username / password), this message box shows it, and loginstatus will be changed to exit the system.
This is very wrong, and I want to fix it.
How can I just "ping" verify the credentials are correct (without sending a test letter).
I am using smtp.gmail.com port 587
Edit This is how I send emails.
var client = new SmtpClient("smtp.gmail.com", 587) { Credentials = new NetworkCredential(username, password), EnableSsl = true }; try { client.Send(fromEmail, toEmail, subject, body); } catch (Exception e) { MessageBox.Show(e.Message); }
source share