0
votes

I am trying to send mail through SMTP but i am getting the error unable to connect remote server, I have tried alot but still getting same error

I am hosted my site on Go Daddy,

please any body suggest me where i am wrong , or is there any settings on GoDaddy server to send mail from "relay-hosting.secureserver.net"

 MailAddress fromAddress = new MailAddress(from);
            message.From = fromAddress;
            message.To.Add(toList);
     System.Net.Mail.SmtpClient Client = new System.Net.Mail.SmtpClient("
relay-hosting.secureserver.net", 25);
   Client.Credentials = CredentialCache.DefaultNetworkCredentials;
            Client.DeliveryMethod = SmtpDeliveryMethod.Network;
            Client.Send(message);
2
Need to send different credentials. See stackoverflow.com/questions/11025633/…Dan Wilson
relay-hosting.secureserver.net does not need you to authenticate with a username and password when you are sending from your hosting account. My error is "Enable to connect remote server "Xicom

2 Answers

0
votes

You are trying to send mail using remote SMTP server, but using credentials from your local environment.

Try to use another credentials class type to specify it more concrete:

Client.Credentials = new System.Net.NetworkCredential("yourusername", "yourpassword");
0
votes

Referring to your code: System.Net.Mail.SmtpClient Client = new System.Net.Mail.SmtpClient(" relay-hosting.secureserver.net", 25);

You're using port 25, which is actually the problem. System Administrators who utilize GoDaddy as their hosting provider may experience trouble sending mail over port 25. This is because GoDaddy requires their servers to send through their own SMTP Relay instead of any third party. This is really a frustration situation, but this is what Godaddy policy is. If you use Godaddy relay, then it will work.