🚀 go-pugleaf

RetroBBS NetNews Server

Inspired by RockSolid Light RIP Retro Guy

Article View: comp.lang.javascript
Article #16

Sending a CDONTS email

#16
From: Ben
Date: Wed, 24 Jul 2002 17:20
57 lines
2735 bytes
Hi Guys,

Can anyone help! I am trying to put together a basic cookie in JavaScript.
The cookie part of the script it working perfectly, no problems there.
However after the cookie has been executed I want the script to send an
email using CDONTS. This is where I am having problems.

I only want the email to be sent if the cookie is executed ie if it exists.
Currently nothing is working, if I take out the email side of the script the
cookie works, but I need both running.

Any ideas where I am going wrong?

<script>
<!--


// page to go to if cookie exists
go_to = "software.htm";

// number of days cookie lives for
num_days = 1;
function ged(noDays){
    var today = new Date();
    var expr = new Date(today.getTime() + noDays*24*60*60*1000);
    return  expr.toGMTString();
}

function readCookie(cookieName){
    var start = document.cookie.indexOf(cookieName);
    if (start == -1){
        document.cookie = "seenit=yes; expires=" + ged(num_days);
    } else {
        window.location = go_to;
    }
}

readCookie("seenit");

// now send the email using CDONTS

Set sendmail = Server.CreateObject("CDONTS.NewMail")
sendmailMsg.From = email@email.com
sendmailMsg.To = user@user.com
sendmailMsg.subject = "Subject"
sendmailMsg.body = "Body"
sendmailMsg.send

// -->
</script>


Hope you can help!

Cheers

Ben
Technical Details
Message-ID: <ahmnhu$cg$1@news5.svr.pol.co.uk>
Path: arc1-ca.pugleaf.net!archiver1.google.com!news1.google.com!newsfeed.stanford.edu!news-spur1.maxwell.syr.edu!news.maxwell.syr.edu!newsfeed.icl.net!newsfeed.fjserv.net!colt.net!kibo.news.demon.net!demon!transit.news.xs4all.nl!131.211.28.48.MISMATCH!news.nl.linux.org!humbolt.nl.linux.org!zen.net.uk!195.92.99.54.MISMATCH!news.cabal.org.uk!newspeer.lavaseals.co.uk!diablo.theplanet.net!news.theplanet.net!not-for-mail

Show Full Headers
Complete Article Headers
X-Google-Language: ENGLISH,ASCII-7-bit
X-Google-Thread: 100e17,c1c4460db7d5ea6e,start
X-Google-Attributes: gid100e17,public
X-Google-Thread: fb3cb,c1c4460db7d5ea6e,start
X-Google-Attributes: gidfb3cb,public
X-Google-ArrivalTime: 2002-07-24 10:20:54 PST
Path: arc1-ca.pugleaf.net!archiver1.google.com!news1.google.com!newsfeed.stanford.edu!news-spur1.maxwell.syr.edu!news.maxwell.syr.edu!newsfeed.icl.net!newsfeed.fjserv.net!colt.net!kibo.news.demon.net!demon!transit.news.xs4all.nl!131.211.28.48.MISMATCH!news.nl.linux.org!humbolt.nl.linux.org!zen.net.uk!195.92.99.54.MISMATCH!news.cabal.org.uk!newspeer.lavaseals.co.uk!diablo.theplanet.net!news.theplanet.net!not-for-mail
From: "Ben" <ben@iow-office.fsnet.co.uk>
Newsgroups: comp.lang.javascript,alive.internet.lang.javascript
Subject: Sending a CDONTS email
Date: Wed, 24 Jul 2002 18:20:12 +0100
Organization: Working from Home
Lines: 59
Message-ID: <ahmnhu$cg$1@news5.svr.pol.co.uk>
Reply-To: "Ben" <ben@iow-office.fsnet.co.uk>
NNTP-Posting-Host: modem-20.anduin.dialup.pol.co.uk
X-Trace: news5.svr.pol.co.uk 1027531134 400 62.136.108.148 (24 Jul 2002 17:18:54 GMT)
NNTP-Posting-Date: 24 Jul 2002 17:18:54 GMT
X-Complaints-To: abuse@theplanet.net
X-Priority: 3
X-MSMail-Priority: Normal
X-Newsreader: Microsoft Outlook Express 6.00.2600.0000
X-MimeOLE: Produced By Microsoft MimeOLE V6.00.2600.0000