Email problem


G

Guest

I have the following code to send an email and I get this error:
[SmtpFailedRecipientException: Mailbox unavailable. The server response was:
<[email protected]> No such user here]. The error is on at last line
below.

SmtpClient smtpClient = new SmtpClient();
MailMessage message = new MailMessage();

MailAddress fromAddress = new MailAddress("(e-mail address removed)",
"POS-eTive Point of Sales.");
// host name of server
smtpClient.Host = "mail.someHost.com";

//Default port will be 25
smtpClient.Port = 25;

//From address will be given as a MailAddress Object
message.From = fromAddress;

// To address collection of MailAddress
message.To.Add(Email.Text);
message.Subject = " auto responder notice.";



// Message body content
message.Body = "some message";

// Send SMTP mail
smtpClient.Send(message);
 
Ad

Advertisements

B

Bgreer5050

Is the site hosted locally or remotely? It seems you might need to
authenticate with a password for the smtp.
 
M

Michael Nemtsev, MVP

Hello Dave,

do u have the right credentials for the SMTP in your web.config?
because as was noted this could lead u to that exception

---
WBR,
Michael Nemtsev [.NET/C# MVP] :: blog: http://spaces.live.com/laflour

"The greatest danger for most of us is not that our aim is too high and we
miss it, but that it is too low and we reach it" (c) Michelangelo


D> I have the following code to send an email and I get this error:
D> [SmtpFailedRecipientException: Mailbox unavailable. The server
D> response was: <[email protected]> No such user here]. The error
D> is on at last line below.
D>
D> SmtpClient smtpClient = new SmtpClient();
D> MailMessage message = new MailMessage();
D> MailAddress fromAddress = new
D> MailAddress("(e-mail address removed)",
D> "POS-eTive Point of
D> Sales.");
D> // host name of server
D> smtpClient.Host = "mail.someHost.com";
D> //Default port will be 25
D> smtpClient.Port = 25;
D> //From address will be given as a MailAddress Object
D> message.From = fromAddress;
D> // To address collection of MailAddress
D> message.To.Add(Email.Text);
D> message.Subject = " auto responder notice.";
D> // Message body content
D> message.Body = "some message";
D> // Send SMTP mail
D> smtpClient.Send(message);
 
Ad

Advertisements

G

Guest

Dave said:
I have the following code to send an email and I get this error:
[SmtpFailedRecipientException: Mailbox unavailable. The server response was:
<[email protected]> No such user here].

I assume the e-mail address you are trying to send to doesn't exist. Try
another one which exists for sure.

SmtpFailedRecipientException Class
Represents the exception that is thrown when the SmtpClient is not able to
complete a Send or SendAsync operation to a particular recipient.

hth,
Andreas
 

Ask a Question

Want to reply to this thread or ask your own question?

You'll need to choose a username for the site, which only take a couple of moments. After that, you can post your question and our members will help you out.

Ask a Question

Top