DevX Home    Today's Headlines   Articles Archive   Tip Bank   Forums   

Results 1 to 2 of 2

Thread: Sending emails using CDO without Exchange.....

  1. #1
    Inam Ul Haq Guest

    Sending emails using CDO without Exchange.....


    Hi all,

    I'm trying to send emails from the IIS server directly using CDO without
    involving exchange. I'm trying it from two different ways.
    1. I wrot a few lines of VBScript on my ASP page to send emails. The page
    is executed fine. But the email never gets to the destination. I'm using
    local IIS on my machine. Our corporate mail sever is different. Am I doing
    right??? I doubt that how that mail address gets resolved? Can I send emails
    using my local machines IIS? Do I need to configure the IIS?

    2. I want to incorporate the same funtionality into my Java component (written
    using VJ++ and runs under MTS). I do a com wrapper for CDONTS. I create the
    object. All the properties set methods go ok. But when I try to execute "send(...)"
    mehtod I get the following run time exception: "ComFailException", with the
    message: "Class not registered".
    My sample code goes below:

    Variant varFrom = null;
    Variant varTo = null;
    Variant varSubject = null;
    Variant varMsgBody = null;
    Variant varImportance = null;

    varFrom = new Variant(edtFrom.getText());
    varTo = new Variant(edtTo.getText());
    varSubject = new Variant(edtSubject.getText());
    varMsgBody = new Variant(edtBody.getText());
    varImportance = new Variant((int)CdoImportance.CdoLow);

    INewMail mail = (INewMail)new NewMail();

    //I've tried setting all the properties explicitly.
    //The program runs fine with them. It only fails
    //on "send(...)" method.
    /*
    mail.setMailFormat(CdoMailFormats.CdoMailFormatText);
    mail.setFrom("inam@thenetplus.com");
    mail.setTo("inam@thenetplus.com");
    mail.setCc ("vnguyen@thenetplus.com");
    mail.setBcc("bcc");
    mail.setSubject("from SMTP");
    mail.setBodyFormat(CdoBodyFormats.CdoBodyFormatText);
    mail.setBody (varMsgBody);
    */

    //The program fails at this pline:
    mail.Send(varFrom, varTo, varSubject, varMsgBody, varImportance);


    What wrong I'm doing? I'll appreciate any ideas.

    Inam.

  2. #2
    Eric S. Lockshine Guest

    Re: Sending emails using CDO without Exchange.....


    "Inam Ul Haq" <haqinam@hotmail.com> wrote:
    >
    >Hi all,
    >
    >I'm trying to send emails from the IIS server directly using CDO without
    >involving exchange. I'm trying it from two different ways.
    >1. I wrot a few lines of VBScript on my ASP page to send emails. The page
    >is executed fine. But the email never gets to the destination. I'm using
    >local IIS on my machine. Our corporate mail sever is different. Am I doing
    >right??? I doubt that how that mail address gets resolved? Can I send emails
    >using my local machines IIS? Do I need to configure the IIS?
    >
    >2. I want to incorporate the same funtionality into my Java component (written
    >using VJ++ and runs under MTS). I do a com wrapper for CDONTS. I create

    the
    >object. All the properties set methods go ok. But when I try to execute

    "send(...)"
    >mehtod I get the following run time exception: "ComFailException", with

    the
    >message: "Class not registered".
    >My sample code goes below:
    >
    >Variant varFrom = null;
    >Variant varTo = null;
    >Variant varSubject = null;
    >Variant varMsgBody = null;
    >Variant varImportance = null;
    >
    >varFrom = new Variant(edtFrom.getText());
    >varTo = new Variant(edtTo.getText());
    >varSubject = new Variant(edtSubject.getText());
    >varMsgBody = new Variant(edtBody.getText());
    >varImportance = new Variant((int)CdoImportance.CdoLow);
    >
    >INewMail mail = (INewMail)new NewMail();
    >
    >//I've tried setting all the properties explicitly.
    >//The program runs fine with them. It only fails
    >//on "send(...)" method.
    >/*
    >mail.setMailFormat(CdoMailFormats.CdoMailFormatText);
    >mail.setFrom("inam@thenetplus.com");
    >mail.setTo("inam@thenetplus.com");
    >mail.setCc ("vnguyen@thenetplus.com");
    >mail.setBcc("bcc");
    >mail.setSubject("from SMTP");
    >mail.setBodyFormat(CdoBodyFormats.CdoBodyFormatText);
    >mail.setBody (varMsgBody);
    >*/
    >
    >//The program fails at this pline:
    >mail.Send(varFrom, varTo, varSubject, varMsgBody, varImportance);
    >
    >
    >What wrong I'm doing? I'll appreciate any ideas.
    >
    >Inam.


    First things first, on the IIS machine you MUST install SMTP and configure
    it properly. Once that is accomplished, sending an email from a web page
    will be easy. Look at the following article on the microsoft web site:Q189945


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


   Development Centers

   -- Android Development Center
   -- Cloud Development Project Center
   -- HTML5 Development Center
   -- Windows Mobile Development Center