Click here to Skip to main content
15,885,914 members
Please Sign up or sign in to vote.
0.00/5 (No votes)
See more:
Dear Sir,


I ready this website(SIDDHA Ayurvedic Health Center[^]) and hosted on the server.I send to information on email-Id but error shows to the email and i send to the exmple of error"
An attempt was made to access a socket in a way forbidden by its access permissions [2607:f8b0:400e:c02::6d]:587
".But Information sent to the email on local server. And not working in main host server.

Contactus.aspx page code

protected void Button1_Click(object sender, EventArgs e)
        {
            StringBuilder sb = new StringBuilder();
            sb.Append("<html><head><title>Email Sending By</title></head>");
            sb.Append("<body>");
            sb.Append("<table cellpadding='5' cellspacing='5' width='400px' border='1'>");
            sb.Append("<tr><td>Name:" + TextBox1.Text + "</td></tr>");
            sb.Append("<tr><td>EmailID:" + TextBox2.Text + "</td></tr>");
            sb.Append("<tr><td>Mobile no:" + TextBox3.Text + "</td></tr>");

            sb.Append("<tr><td>Query:" + TextBox4.Text + "</td></tr>");
            sb.Append("</table></body></html>");
            MAILINGS.sendemails("XXXXayurvedichealthcenter@gmail.com", "Query", sb.ToString());

            TextBox1.Text = "";
            TextBox2.Text = "";
            TextBox3.Text = "";
            TextBox4.Text = "";
            Label1.Visible = true;
            Label1.ForeColor = System.Drawing.Color.Gold;
            Label1.Text = "Thank you for getting in touch!";
           


        }



Mailings.cs page code

public static void sendemails(string to, string sub, string body)
       {
           MailMessage mm = new MailMessage();
           mm.From = new MailAddress("xxxxxayurvedichealthcenter@gmail.com", "SIDDHA Ayurvedic Health Center");
           mm.To.Add(to);
           mm.Subject = sub;
           mm.Body = body;

           mm.IsBodyHtml = true;
           mm.Priority = MailPriority.High;
           SmtpClient ss = new SmtpClient();
           ss.Credentials = new NetworkCredential("xxxxxayurvedichealthcenter@gmail.com", "xxxxxxx07");

           ss.Port = 587;
           ss.Host = "smtp.gmail.com";
           ss.EnableSsl = true;
           ss.Send(mm);
       }


What I have tried:

help me to  solve this error "An attempt was made to access a socket in a way forbidden by its access permissions [2607:f8b0:400e:c02::6d]:587"
Posted
Updated 27-Nov-17 22:14pm
v2
Comments
Sinisa Hajnal 28-Nov-17 3:31am    
As the error say: your credentials don't have access rights. Resolve that and the error will go away.
Nishant.Chauhan80 28-Nov-17 3:58am    
But sir on local server works fine same credentials
ZurdoDev 28-Nov-17 7:34am    
That means something is different on the server. You'll have to figure out what that is.
Jochen Arndt 28-Nov-17 4:35am    
Check the firewall settings on the server. If firewall logging is enabled (it is not by default), you might also check the log.

However, there may be also other reasons for this error.

This content, along with any associated source code and files, is licensed under The Code Project Open License (CPOL)



CodeProject, 20 Bay Street, 11th Floor Toronto, Ontario, Canada M5J 2N8 +1 (416) 849-8900