Error in asp while sending mail using MS outlook

Discussion in 'ASP General' started by Rishi, Sep 17, 2009.

  1. Rishi

    Rishi Guest

    Im using the below code to send a mail from my asp form.

    Set ObjMail = Server.CreateObject("Outlook.Application")
    Set ObjMsg = Server.CreateObject("Outlook.MailItem")
    Set ObjMsg = ObjMail.CreateItem(0)
    ObjMsg.To = Trim(Request.Form("txtto"))
    ObjMsg.CC = Trim(Request.Form("txtCc"))
    ObjMsg.BCC = Trim(Request.Form("txtBc"))
    ObjMsg.Subject = Trim(Request.Form("txtSub"))
    ObjMsg.HTMLBody = strBody
    ObjMsg.Send

    This is giving the error:

    Server object, ASP 0177 (0x80080005)
    Server execution failed
    /MailTest.asp, line 56

    But the same type code is working in vb application.

    If anybody having ideal pls help us.

    Regards,
    Rishi
    Rishi, Sep 17, 2009
    #1
    1. Advertising

  2. Rishi

    Bob Barrows Guest

    Rishi wrote:
    > Im using the below code to send a mail from my asp form.
    >
    > Set ObjMail = Server.CreateObject("Outlook.Application")
    > Set ObjMsg = Server.CreateObject("Outlook.MailItem")
    > Set ObjMsg = ObjMail.CreateItem(0)
    > ObjMsg.To = Trim(Request.Form("txtto"))
    > ObjMsg.CC = Trim(Request.Form("txtCc"))
    > ObjMsg.BCC = Trim(Request.Form("txtBc"))
    > ObjMsg.Subject = Trim(Request.Form("txtSub"))
    > ObjMsg.HTMLBody = strBody
    > ObjMsg.Send
    >
    > This is giving the error:
    >
    > Server object, ASP 0177 (0x80080005)
    > Server execution failed
    > /MailTest.asp, line 56
    >
    > But the same type code is working in vb application.
    >
    > If anybody having ideal pls help us.
    >

    Don't try to use Outlook in ASP.
    http://support.microsoft.com/default.aspx?scid=kb;en-us;257757
    Use CDO. Start here:
    http://www.aspfaq.com/search.asp?q=CDO&x=0&y=0

    --
    Microsoft MVP - ASP/ASP.NET - 2004-2007
    Please reply to the newsgroup. This email account is my spam trap so I
    don't check it very often. If you must reply off-line, then remove the
    "NO SPAM"
    Bob Barrows, Sep 17, 2009
    #2
    1. Advertising

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

It takes just 2 minutes to sign up (and it's free!). Just click the sign up button to choose a username and then you can ask your own questions on the forum.
Similar Threads
  1. Replies:
    4
    Views:
    55,468
  2. Replies:
    0
    Views:
    1,356
  3. Don Quijote de Nicaragua

    Error + Send Mail + ERROR: Failure sending mail.

    Don Quijote de Nicaragua, Jun 26, 2008, in forum: ASP .Net
    Replies:
    5
    Views:
    1,517
    Don Quijote de Nicaragua
    Jun 26, 2008
  4. martin smith
    Replies:
    3
    Views:
    330
    Jeff Cochran
    Mar 21, 2005
  5. Replies:
    2
    Views:
    981
    A. Sinan Unur
    May 25, 2006
Loading...

Share This Page