iam thinking that the port no is wrong
for gmail port no is 587 n smtp is smtp.gmail.com
and also ssl should be enabled

On Wed, Dec 16, 2009 at 10:08 PM, [email protected] <
[email protected]> wrote:

> Hello, I'm posting this in response to an error I keep receiving when
> I try to send an email on a web application I developed.  I am
> programming in C# in asp.net.
>
> When running or debugging my site, I receive the error:  "Mailbox
> unavailable. The server response was: #5.1.0 Address rejected
> [email protected]".  I have verified both the sending and receiving
> addresses, so I suspect that the problem may lie within my smtp
> settings.
>
> I'm using IIS7 to configure this, and when I go to the SMTP Email
> module (there's one on my computer's tree node as well as my website's
> tree node, so I'm unsure which is the appropriate one to change, since
> the settings can be changed independently), I have my sending email
> address set, "Deliver email to SMTP server" option selected, the smtp
> server set as smtp.xx.com, and the standard port 25.
>
> If it is any relevance, my company's email is driven with gmail, so
> maybe I need to say smtp.gmail.com?
>
> This website is running on the localhost for the other computers on my
> company's network, but when I set the smtp server as localhost, I get
> a generic "Failure sending mail" (literally) message.
>
> If the SMTP settings are not the problem, a sample of my code is:
>
>    public static void SendMailMessage(string from, string to, string
> subject, string body)
>    {
>        SmtpClient serv = new SmtpClient();
>        MailMessage msg = new MailMessage();
>        msg.From = new MailAddress(from);
>        msg.To.Add(to);
>        msg.Body = body;
>        msg.Subject = subject;
>        msg.IsBodyHtml = true;
>        serv.DeliveryMethod = SmtpDeliveryMethod.Network;
>        serv.Send(msg);
>    }
> the 'to' address I have passed is my own email address
>
> My web.config file has the following modifications as well:
>
>  <system.net>
>    <mailSettings>
>      <smtp from="[email protected]">
>        <network defaultCredentials="true" host="smtp.xx.com"
> port="25" />
>      </smtp>
>    </mailSettings>
>  </system.net>
>
> Any help would be greatly appreciated.  Thank you.
>

Reply via email to