-
Sending an email not working?
I am using the MailMessage object to send e-mail.But it still not sending
an email.
Here is the code:
I have refrenced <%@ Import Namespace="System.Web.Mail" %> file in my program.
try
{
email = new MailMessage();
email.From= mFrom;
email.To = mTo;
email.Subject = mSubject;
email.Body = mBody;
email.BodyFormat =mBodyFormat;
email.Priority=MailPriority.High;
SmtpMail.Send(email);
mErrmsg="Success";
}
catch
{
mErrmsg = "Error Sending Message";
}
If I step through the above code it execute without error .But still when
I check for the e-mail, I never receive it.Let me know what is wrong with
the above code?
So why I am not able to get the email which is sended by using above code.
thanks,
Geeta.
-
Re: Sending an email not working?
well I dont see any problem with the code & since its executing w/o any
errors..most probably its getting queued up in your mail queue.
-Sachin
"geeta" <dotnetgeeta@hotmail.com> wrote in message
news:3baf7d14$1@news.devx.com...
>
> I am using the MailMessage object to send e-mail.But it still not
sending
> an email.
>
> Here is the code:
> I have refrenced <%@ Import Namespace="System.Web.Mail" %> file in my
program.
>
> try
> {
>
> email = new MailMessage();
> email.From= mFrom;
> email.To = mTo;
> email.Subject = mSubject;
> email.Body = mBody;
> email.BodyFormat =mBodyFormat;
> email.Priority=MailPriority.High;
> SmtpMail.Send(email);
> mErrmsg="Success";
> }
> catch
> {
> mErrmsg = "Error Sending Message";
> }
>
> If I step through the above code it execute without error .But still when
> I check for the e-mail, I never receive it.Let me know what is wrong with
> the above code?
>
> So why I am not able to get the email which is sended by using above code.
>
>
> thanks,
> Geeta.
-
Re: Sending an email not working?
Geeta,
Have you tried setting the SmtpServer property before calling Send()?:
SmtpMail.SmtpServer = "smtp.mailserver.co.uk";
Maybe your app just doesn't know where to route the mail message?
Hope this helps.
Paul Jackson
pr_jackson@hotmail.com
"Sachin" <sachin.nigam@orbit-e.com> wrote in message
news:3baf8214@news.devx.com...
> well I dont see any problem with the code & since its executing w/o any
> errors..most probably its getting queued up in your mail queue.
> -Sachin
> "geeta" <dotnetgeeta@hotmail.com> wrote in message
> news:3baf7d14$1@news.devx.com...
> >
> > I am using the MailMessage object to send e-mail.But it still not
> sending
> > an email.
> >
> > Here is the code:
> > I have refrenced <%@ Import Namespace="System.Web.Mail" %> file in my
> program.
> >
> > try
> > {
> >
> > email = new MailMessage();
> > email.From= mFrom;
> > email.To = mTo;
> > email.Subject = mSubject;
> > email.Body = mBody;
> > email.BodyFormat =mBodyFormat;
> > email.Priority=MailPriority.High;
> > SmtpMail.Send(email);
> > mErrmsg="Success";
> > }
> > catch
> > {
> > mErrmsg = "Error Sending Message";
> > }
> >
> > If I step through the above code it execute without error .But still
when
> > I check for the e-mail, I never receive it.Let me know what is wrong
with
> > the above code?
> >
> > So why I am not able to get the email which is sended by using above
code.
> >
> >
> > thanks,
> > Geeta.
>
>
Posting Permissions
- You may not post new threads
- You may not post replies
- You may not post attachments
- You may not edit your posts
-
Forum Rules
|
Development Centers
-- Android Development Center
-- Cloud Development Project Center
-- HTML5 Development Center
-- Windows Mobile Development Center
|