asp.netiis

System.Net.Mail.SmtpFailedRecipientException: Mailbox unavailable.


I get this error when trying to send an email using Asp.net application using SMTP on IIS 7.5

The error is "System.Net.Mail.SmtpFailedRecipientException: Mailbox unavailable. The server response was: No such user here at System.Net.Mail.SmtpTransport.SendMail(... "

What i have in web.config is

<system.net>
<mailSettings>
<smtp from="support@mysite.com" deliveryMethod="Network">
<network host="hostname" port="25" password="password" userName="you@yoursite.com" />
</smtp>
</mailSettings>
</system.net>

I really don't understand what should be the username and password here. I get the same error when i put defaultcredentials = "true" instead of username and password. Is there something to do with toaddress. The toaddress is myid@mydomain.com, which works for all other emails, etc.

Please advice me where i am doing wrong!! Thank you in advance!


Solution

  • The userName and password settings refer to the credentials for connecting to the SMTP server. Make sure you don't confuse this with the username and password for the from or to address, which is not relevant to the SMTP server.

    You may want to try a tool like SMTPDiag to help you figure out any SMTP connectivity issues you have. However, your error seems to indicate that connectivity is fine but that mail cannot be delivered.