-1

I want to make a program to check mail and password match or not.

SMTP.Credentials = New System.Net.NetworkCredential(email, pass)
SMTP.Send(emailMessage)

I can check send Ok mean match, can not send email and pass dont match. But hope you show me better method.thanks

CodeCaster
  • 147,647
  • 23
  • 218
  • 272
  • With _"to check mail and password match or not"_, do you mean you want to verify whether the user identified by `email` and `pass` is allowed to connect to the server specified in `SMTP` and send an email message? – CodeCaster Nov 12 '13 at 13:31
  • 1
    If that is the case, this is a doppelgänger of [How to validate smtp credentials before sending mail?](http://stackoverflow.com/questions/2426098/how-to-validate-smtp-credentials-before-sending-mail-in-c). – CodeCaster Nov 12 '13 at 13:34

1 Answers1

0

You cannot check credentials without attempting a send. If the send fails, it will throw an SmtpException. You could check the SmtpStatusCode property for more detail.

Colin Pickard
  • 45,724
  • 13
  • 98
  • 148