• GoDaddy Community
  • Websites + Marketing | Website Builders
  • Websites + Marketing | Website Builders

    cancel
    Showing results for 
    Show  only  | Search instead for 
    Did you mean: 

    Can't use Sendgrid with my C#

    Hello,

    I am getting following error:

    An attempt was made to access a socket in a way forbidden by its access permissions XXXX:587

    An attempt was made to access a socket in a way forbidden by its access permissions XXXX:587

    It is working from my computer and from Azure. I deployed same code to GoDaddy Windows hosting and this code generate an error:

    var smtpClient = new SmtpClient("smtp.sendgrid.net", Convert.ToInt32(587));
    smtpClient.EnableSsl = true;
    smtpClient.Credentials = new NetworkCredential("***********@azure.com", "******");
    smtpClient.DeliveryMethod = SmtpDeliveryMethod.Network;
    var mail = new MailMessage();
    mail.To.Add(recipientAddr);
    mail.From = new MailAddress(senderAddr);
    mail.Subject = mailSubj;
    mail.Body = mailContent;
    mail.IsBodyHtml = true;
    smtpClient.Send(mail);

    I suspect that port 587 is blocked for outside from Godaddy.

     

    Any ideas?

    0 REPLIES 0