I was trying to send mail from my website and i got this error
An attempt was made to access a socket in a way forbidden by its access permissions 108.177.119.108:587
May I please know what caused it and how to resolve?
Here is the code to send to email.
using (MailMessage mm = new MailMessage("georgeakpan13@gmail.com", mailtxtbx.Text))
{
mm.Subject = "Account Activation";
string body = "Hello " + txtname.Text.Trim() + ",";
body += "<br /><br />Your Quirver Registration has been successful.";
body += "<br /><br />Please click the Button below to activate your account";
body += "<br /><br /><a style='display: block; width: 130px; height: 15px; background: #355171;padding: 10px;font-family: Nunito; text-align:center; border-radius: 5px;color: white;font-weight: bold;text-decoration: none;' href = '"
+ Request.Url.AbsoluteUri.Replace("signup", "AccountActivation.aspx?ActivationCode="
+ activationCode) + "'>Click here to activate your account.</a>";
body += "<br /><br />Thanks";
mm.Body = body;
mm.IsBodyHtml = true;
SmtpClient SMTP = new SmtpClient("smtp.gmail.com", 587);
SMTP.UseDefaultCredentials = false;
SMTP.Credentials = new NetworkCredential()
{
UserName = "georgeakpan13@gmail.com",
Password = "XXXXXXX"
};
SMTP.EnableSsl = true;
SMTP.Send(mm);
}