I am trying to send an email using the following very standard code. However, I get the error that follow…
MailMessage message = new MailMessage();
message.Sender = new MailAddress("sen@der.com");
message.To.Add("reci@pient.com");
message.Subject = "test subject";
message.Body = "test body";
SmtpClient client = new SmtpClient();
client.Host = "mail.myhost.com";
//client.Port = 587;
NetworkCredential cred = new NetworkCredential();
cred.UserName = "sen@der.com";
cred.Password = "correct password";
cred.Domain = "mail.myhost.com";
client.Credentials = cred;
client.UseDefaultCredentials = false;
client.Send(message);
Mailbox unavailable. The server
response was: No such
user here.
This recipient email address definitely works. To make this account work I had to do some special steps in outlook. Specifically, I had to do change account settings -> more settings -> outgoing server -> my outgoing server requires authentication & use same settings. I am wondering if there is some other strategy.
I think the key here is that my host is Server Intellect and I know that some people on here use them so hopefully someone else has been able to get through this. I did talk to support but they said with coding issues I am on my own 😮
try this…
… you should not need to provide the
.Domainunless you are using Kerberos or some other complex authentication.Edit…
Check out my extended answer. It has an example of how to send an email with authentication. It’s also has SSL enabled so you may need to remove that part.