code for mailing using CDO written in JavaScript

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

    code for mailing using CDO written in JavaScript

    Hi,

    I usually use VBScript to send emails, however I need to use JavaScript.

    Can anyone supply the necessary code - I have tried this literal translation
    and although it doesn't cause any errors, no mail arrives.

    var sch = "http://schemas.microso ft.com/cdo/configuration/";

    var cdoConfig = Server.CreateOb ject("CDO.Confi guration");

    cdoConfig.Field s.Item(sch & "sendusing" ) = 2;
    cdoConfig.Field s.Item(sch & "smtpserver ") = "smtp.xyz.co.uk ";
    cdoConfig.Field s.Update();

    var cdoMessage = Server.CreateOb ject("CDO.Messa ge");

    cdoMessage.Conf iguration = cdoConfig;
    cdoMessage.From = "info@.xyz.co.u k";
    cdoMessage.To = "test@abc.co.uk ";
    cdoMessage.Subj ect = sSubject;
    cdoMessage.Text Body = sBody;
    cdoMessage.Send ();

    Any help appreciated.

    Regards,

    NEIL


  • Dave Anderson

    #2
    Re: code for mailing using CDO written in JavaScript

    Neil Jarman wrote:[color=blue]
    > cdoConfig.Field s.Item(sch & "sendusing" ) = 2;
    > cdoConfig.Field s.Item(sch & "smtpserver ") = "smtp.xyz.co.uk ";[/color]

    Do you truly intend to use the bitwise & here, or were you trying to
    concatenate (+ in JScript)?


    --
    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. Please do not contact
    me directly or ask me to contact you directly for assistance. If your
    question is worth asking, it's worth posting.


    Comment

    • Neil Jarman

      #3
      Re: code for mailing using CDO written in JavaScript

      Ahh - you're quite right!

      After many many years coding in VB, I quite forget (or miss) JS little
      differences sometimes!!

      Many thanks.

      NEIL




      "Dave Anderson" <GTSPXOESSGOQ@s pammotel.com> wrote in message
      news:122vngfbqb 25aed@corp.supe rnews.com...[color=blue]
      > Neil Jarman wrote:[color=green]
      >> cdoConfig.Field s.Item(sch & "sendusing" ) = 2;
      >> cdoConfig.Field s.Item(sch & "smtpserver ") = "smtp.xyz.co.uk ";[/color]
      >
      > Do you truly intend to use the bitwise & here, or were you trying to
      > concatenate (+ in JScript)?
      >
      >
      > --
      > 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. Please do not
      > contact me directly or ask me to contact you directly for assistance. If
      > your question is worth asking, it's worth posting.
      >[/color]


      Comment

      Working...