DevX Home    Today's Headlines   Articles Archive   Tip Bank   Forums   

+ Reply to Thread
Results 1 to 3 of 3

Hybrid View

  1. #1
    geeta Guest

    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.

  2. #2
    Sachin Guest

    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.




  3. #3
    Paul Jackson Guest

    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.

    >
    >




Bookmarks

Posting Permissions

  • You may not post new threads
  • You may not post replies
  • You may not post attachments
  • You may not edit your posts
HTML5 Development Center
 
 
FAQ
Latest Articles
Java
.NET
XML
Database
Enterprise
Questions? Contact us.
C++
Web Development
Wireless
Latest Tips
Open Source


Top DevX Stories

Easy Web Services with SQL Server 2005 HTTP Endpoints
JavaOne 2005: Java Platform Roadmap Focuses on Ease of Development, Sun Focuses on the "Free" in F.O.S.S.
Wed Yourself to UML with the Power of Associations
Microsoft to Add AJAX Capabilities to ASP.NET
IBM's Cloudscape Versus MySQL


Sponsored Links