I created a web form that sends out an email. When the email address in the toAddr is for example johndoe@company.com it works, but if I try johndoe@yahoo.com or johndoe@gmail.com it does not work. The email sends only internally.
This the error I get: "System.Net.Mail.SmtpFailedRecipientException: Mailbox unavailable. The server response was: 5.7.1 Unable to relay"
SmtpClient client = new SmtpClient("mail.company.com");
MailAddress toAddr = new MailAddress("johndoe@yahoo.com");
MailAddress fromAddr = new MailAddress("notify@company.com");
String messageText1 = "<h4>Thank you.</h4>";
string messageSubject = "Confirmation";
MailMessage message = new MailMessage(fromAddr, toAddr);
message.IsBodyHtml = true;
message.Subject = messageSubject;
message.Body = messageText1;
client.Send(message);