How to send a mail outside the network. Currently i'm using the below code:
MailMessage objMailMsg = new MailMessage();
MailAddress FromAddress = new MailAddress("from@testmail.net");
MailAddress ToAddress = new MailAddress("to@testmail.net");
objMailMsg.From = FromAddress;
objMailMsg.To.Add(ToAddress);
objMailMsg.Subject = "Test";
objMailMsg.Body = "This is a test mail";
objMailMsg.IsBodyHtml = true;
int port = 25;
string IPaddr = "10.1.0.125";
SmtpClient smtpClient = new SmtpClient();
smtpClient.Port = port;
smtpClient.Host = IPaddr;
smtpClient.Send(objMailMsg);
On running, I'm getting an exception: Mailbox unavailable. The server response was: 5.7.1 Unable to relay
Where should I change. In code or is it SMTP related?