Been sending emails from my C# application for awhile now. But tried tonight, and its not working. Been googling but have to come across anything anything with the exception message I am getting.
Exception: System.Net.Mail.SmtpException
Message: Mailbox unavailable. The server response was: 5.7.1 The message contains an unauthorized custom from address because the
<--- this is where the message ends, not much help.
MailMessage _Mail;
_Mail = new MailMessage("myEmailAddress@gmail.com", "friendsEmail@elseWhere.com");
_Mail.Subject = "Subject";
_Mail.IsBodyHtml = true;
// Create HTML body
var htmlBody = "...";
_Mail.Body = htmlBody;
SmtpClient client = new SmtpClient();
client.Port = 587;
client.DeliveryMethod = SmtpDeliveryMethod.Network;
client.UseDefaultCredentials = false;
client.Host = "smtp.gmail.com";
client.EnableSsl = true;
client.Credentials = new System.Net.NetworkCredential("myEmailAddress@gmail.com","password");
client.Send(_Mail);
Any idea what is wrong?
Edit: I am using .Net 3.5