c# Sending emails with authentication. standard approach not working

Posted by Ready Cent on Stack Overflow See other posts from Stack Overflow or by Ready Cent
Published on 2010-05-17T16:50:17Z Indexed on 2010/05/18 7:20 UTC
Read the original article Hit count: 222

Filed under:
|
|

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("[email protected]");
message.To.Add("[email protected]");
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 = "[email protected]";
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 :o

© Stack Overflow or respective owner

Related posts about c#

Related posts about mail