javascript and email (part 2)

Collapse
This topic is closed.
X
X
 
  • Time
  • Show
Clear All
new posts
  • rvj

    javascript and email (part 2)


    Ive come a cross another issue when trying to convert CDO VB to JS

    The basic send generated the SendUsing configuration is invalid which I
    understand means I have to specify the smpt server (amongst other
    things)using the configuration object

    *************** *************** ****

    Set objConfig = Server.CreateOb ject("CDO.Confi guration")
    objConfig.Field s(cdoSendUsingM ethod) = cdoSendUsingPor t
    objConfig.Field s(cdoSMTPServer )="smtp.server. co.uk"
    objConfig.Field s(cdoSMTPServer Port)=25
    objConfig.Field s(cdoSMTPAuthen ticate)=cdoBasi c
    objConfig.Field s(cdoSendUserNa me) = "mxxxxxxxx-x"
    objConfig.Field s(cdoSendPasswo rd) = "xxxxxxxx"
    Set objMail.Configu ration = objConfig

    *************** *********

    so do I assume that the following COM syntax should work with JS and
    are the cdoconstants script independent ?

    *************** ********


    var objConfig = Server.CreateOb ject("CDO.Confi guration")
    objConfig.Field s(cdoSendUsingM ethod) = cdoSendUsingPor t
    objConfig.Field s(cdoSMTPServer )="smtp.server. co.uk"
    objConfig.Field s(cdoSMTPServer Port)=25
    objConfig.Field s(cdoSMTPAuthen ticate)=cdoBasi c
    objConfig.Field s(cdoSendUserNa me) = "mxxxxxxxx-x"
    objConfig.Field s(cdoSendPasswo rd) = "xxxxxxxx"
    objConfig.Field s.Update ()

    var objMail.Configu ration = objConfig


  • Anthony Jones

    #2
    Re: javascript and email (part 2)


    "rvj" <rvj@rolemodels .netwrote in message
    news:ugcCeQfVHH A.1208@TK2MSFTN GP03.phx.gbl...
    >
    Ive come a cross another issue when trying to convert CDO VB to JS
    >
    The basic send generated the SendUsing configuration is invalid which I
    understand means I have to specify the smpt server (amongst other
    things)using the configuration object
    >
    *************** *************** ****
    >
    Set objConfig = Server.CreateOb ject("CDO.Confi guration")
    objConfig.Field s(cdoSendUsingM ethod) = cdoSendUsingPor t
    objConfig.Field s(cdoSMTPServer )="smtp.server. co.uk"
    objConfig.Field s(cdoSMTPServer Port)=25
    objConfig.Field s(cdoSMTPAuthen ticate)=cdoBasi c
    objConfig.Field s(cdoSendUserNa me) = "mxxxxxxxx-x"
    objConfig.Field s(cdoSendPasswo rd) = "xxxxxxxx"
    Set objMail.Configu ration = objConfig
    >
    *************** *********
    >
    so do I assume that the following COM syntax should work with JS and
    are the cdoconstants script independent ?
    >
    *************** ********
    >
    >
    var objConfig = Server.CreateOb ject("CDO.Confi guration")
    objConfig.Field s(cdoSendUsingM ethod) = cdoSendUsingPor t
    objConfig.Field s(cdoSMTPServer )="smtp.server. co.uk"
    objConfig.Field s(cdoSMTPServer Port)=25
    objConfig.Field s(cdoSMTPAuthen ticate)=cdoBasi c
    objConfig.Field s(cdoSendUserNa me) = "mxxxxxxxx-x"
    objConfig.Field s(cdoSendPasswo rd) = "xxxxxxxx"
    objConfig.Field s.Update ()
    >
    var objMail.Configu ration = objConfig
    >
    You are going to need to find the constant and enumeration values for all
    the cdo members you want to use and create variables to hold them so that
    code such as the above will work. For example

    var cdo = {}

    cdo.SendUsingMe thod =
    'http://schemas.microso ft.com/cdo/configuration/sendusing'
    cdo.SMTPServer = 'http://schemas.microso ft.com/cdo/configuration/smtpserver'
    cdo.SendUsingPo rt = 2

    objConfig.Field s(cdo.SendUsing Method) = cdo.SendUsingPo rt




    Comment

    • Dave Anderson

      #3
      Re: javascript and email (part 2)

      "Anthony Jones" wrote:
      You are going to need to find the constant and enumeration values
      for all the cdo members you want to use and create variables to
      hold them so that code such as the above will work.
      No, he will not need to do that. He can use a TYPELIB declaration in
      global.asa and drive right on as in his example.



      --
      Dave Anderson

      Unsolicited commercial email will be read at a cost of $500 per message. Use
      of this email address implies consent to these terms.

      Comment

      • Anthony Jones

        #4
        Re: javascript and email (part 2)


        "Dave Anderson" <NYRUMTPELVWH@s pammotel.comwro te in message
        news:12tq5vbpti 21443@corp.supe rnews.com...
        "Anthony Jones" wrote:
        You are going to need to find the constant and enumeration values
        for all the cdo members you want to use and create variables to
        hold them so that code such as the above will work.
        >
        No, he will not need to do that. He can use a TYPELIB declaration in
        global.asa and drive right on as in his example.
        >
        >
        You're quite right. I was under the impression for some reason that only
        worked in the VBScript environment but it does indeed work with JScript just
        as well. Eg.:-

        <%@language=JSc ript%>
        <!-- METADATA NAME="Microsoft CDO For Exchange 2000 Library"
        TYPE="TypeLib" UUID="{CD000000-8B95-11D1-82DB-00C04FB1625D}" -->
        <%
        Response.Write( cdoSMTPServer)
        %>

        If only one or two pages need the type library it might be better to just
        place the METADATA directive in just those pages rather than in the
        global.asa.



        Comment

        • rvj

          #5
          Re: javascript and email (part 2)



          Anyway - thanks to both of you !!!!


          I finally managed to send an email !!!


          "Anthony Jones" <Ant@yadayadaya da.comwrote in message
          news:OVZ0EDmVHH A.1360@TK2MSFTN GP02.phx.gbl...
          >
          "Dave Anderson" <NYRUMTPELVWH@s pammotel.comwro te in message
          news:12tq5vbpti 21443@corp.supe rnews.com...
          >"Anthony Jones" wrote:
          You are going to need to find the constant and enumeration values
          for all the cdo members you want to use and create variables to
          hold them so that code such as the above will work.
          >>
          >No, he will not need to do that. He can use a TYPELIB declaration in
          >global.asa and drive right on as in his example.
          >>
          >>
          >
          You're quite right. I was under the impression for some reason that only
          worked in the VBScript environment but it does indeed work with JScript
          just
          as well. Eg.:-
          >
          <%@language=JSc ript%>
          <!-- METADATA NAME="Microsoft CDO For Exchange 2000 Library"
          TYPE="TypeLib" UUID="{CD000000-8B95-11D1-82DB-00C04FB1625D}" -->
          <%
          Response.Write( cdoSMTPServer)
          %>
          >
          If only one or two pages need the type library it might be better to just
          place the METADATA directive in just those pages rather than in the
          global.asa.
          >
          >
          >

          Comment

          • rvj

            #6
            Re: javascript and email (part 2)

            PS

            Just out of interest does anyone know if its possible to turn off CDO
            sender address checking (.From property) ?

            From
            E-mail address of the primary author of the message. This property is
            optional; if left blank, the From property will be set to the value of the
            Sender property, assuming a value for this property has been configured. If
            neither the From property nor the Sender property is configured, the script
            will fail.



            It only appears to accept an "email type" syntax rather than plain text.
            However most of the emails I recieve tend to have the From content in plain
            text so I assume this is possible?.



            "rvj" <rvj@rolemodels .netwrote in message
            news:uSw0zOnVHH A.4828@TK2MSFTN GP05.phx.gbl...
            >
            >
            Anyway - thanks to both of you !!!!
            >
            >
            I finally managed to send an email !!!
            >
            >
            "Anthony Jones" <Ant@yadayadaya da.comwrote in message
            news:OVZ0EDmVHH A.1360@TK2MSFTN GP02.phx.gbl...
            >>
            >"Dave Anderson" <NYRUMTPELVWH@s pammotel.comwro te in message
            >news:12tq5vbpt i21443@corp.sup ernews.com...
            >>"Anthony Jones" wrote:
            >You are going to need to find the constant and enumeration values
            >for all the cdo members you want to use and create variables to
            >hold them so that code such as the above will work.
            >>>
            >>No, he will not need to do that. He can use a TYPELIB declaration in
            >>global.asa and drive right on as in his example.
            >>>
            >>>
            >>
            >You're quite right. I was under the impression for some reason that only
            >worked in the VBScript environment but it does indeed work with JScript
            >just
            >as well. Eg.:-
            >>
            ><%@language=JS cript%>
            ><!-- METADATA NAME="Microsoft CDO For Exchange 2000 Library"
            >TYPE="TypeLi b" UUID="{CD000000-8B95-11D1-82DB-00C04FB1625D}" -->
            ><%
            >Response.Write (cdoSMTPServer)
            >%>
            >>
            >If only one or two pages need the type library it might be better to just
            >place the METADATA directive in just those pages rather than in the
            >global.asa.
            >>
            >>
            >>
            >
            >

            Comment

            • Dave Anderson

              #7
              Re: javascript and email (part 2)

              Anthony Jones wrote:
              If only one or two pages need the type library it might be
              better to just place the METADATA directive in just those
              pages rather than in the global.asa.
              Better how?

              I ask because it is not clear to me that there is a performance issue. After
              all, Application_OnS tart() is in global.asa, and it does not get used by
              every page/request, so it occurs to me that the TYPELIB may simply be loaded
              with the application. I understand that using the TYPELIB is more costly
              than adovbs.inc (or equivalent) at runtime, but that would seem to be true
              whether you put it directly in your script or in the global.asa, wouldn't
              it?



              --
              Dave Anderson

              Unsolicited commercial email will be read at a cost of $500 per message. Use
              of this email address implies consent to these terms.


              Comment

              • Anthony Jones

                #8
                Re: javascript and email (part 2)


                "Dave Anderson" <NYRUMTPELVWH@s pammotel.comwro te in message
                news:efZH7GoVHH A.4568@TK2MSFTN GP02.phx.gbl...
                Anthony Jones wrote:
                If only one or two pages need the type library it might be
                better to just place the METADATA directive in just those
                pages rather than in the global.asa.
                >
                Better how?
                >
                It just doesn't make sense to modify a global resource for the benefit of
                just one or two pages.
                I ask because it is not clear to me that there is a performance issue.
                After
                all, Application_OnS tart() is in global.asa, and it does not get used by
                every page/request, so it occurs to me that the TYPELIB may simply be
                loaded
                with the application. I understand that using the TYPELIB is more costly
                than adovbs.inc (or equivalent) at runtime, but that would seem to be true
                whether you put it directly in your script or in the global.asa, wouldn't
                it?
                I'm surprised to hear that. I would have thought the use of adovbs.inc was
                more expensive but I've never really looked into.




                Comment

                • Dave Anderson

                  #9
                  Re: javascript and email (part 2)

                  "Anthony Jones" wrote:
                  >I understand that using the TYPELIB is more costly than
                  >adovbs.inc (or equivalent) at runtime, but that would seem
                  >to be true whether you put it directly in your script or
                  >in the global.asa, wouldn't it?
                  >
                  I'm surprised to hear that. I would have thought the use of
                  adovbs.inc was more expensive but I've never really looked
                  into.
                  Judge for yourself:


                  In particular, note Eric's acknowledgement that we often trade performance
                  for ease of use. I have absolutely no problem throwing ADO and CDO TYPELIB
                  declarations in my application roots because I never know A PRIORI if/where
                  I will need them.



                  --
                  Dave Anderson

                  Unsolicited commercial email will be read at a cost of $500 per message. Use
                  of this email address implies consent to these terms.

                  Comment

                  • Anthony Jones

                    #10
                    Re: javascript and email (part 2)


                    "Dave Anderson" <NYRUMTPELVWH@s pammotel.comwro te in message
                    news:12tso4jjo2 lls5f@corp.supe rnews.com...
                    "Anthony Jones" wrote:
                    I understand that using the TYPELIB is more costly than
                    adovbs.inc (or equivalent) at runtime, but that would seem
                    to be true whether you put it directly in your script or
                    in the global.asa, wouldn't it?
                    I'm surprised to hear that. I would have thought the use of
                    adovbs.inc was more expensive but I've never really looked
                    into.
                    >
                    Judge for yourself:

                    >
                    A very interesting series of articles, thanks.
                    In particular, note Eric's acknowledgement that we often trade performance
                    for ease of use. I have absolutely no problem throwing ADO and CDO TYPELIB
                    declarations in my application roots because I never know A PRIORI
                    if/where
                    I will need them.
                    Ok I can see that point of view also make sense.



                    Comment

                    Working...