After searching through the web and asking around people, I finally realised that, because the project was built few years ago and had the old SMTP server configuration passed into it, it was failing to connect to the server to send the emails. Changing the SMTP server sorted out the problem straight away in my case, but there may be other problems responsible for the same exception being thrown. Sender email address and its credentials must be correctly set (for example, if you are using gmail's SMTP server, you should set the username and password to send as the particular user), or use default credential (Property for SmtpClient).
thank you dear, it works
ReplyDelete