🚀 go-pugleaf

RetroBBS NetNews Server

Inspired by RockSolid Light RIP Retro Guy

Article View: comp.lang.javascript
Article #18

Re: Sending a CDONTS email

#18
From: Grant Wagner
Date: Wed, 24 Jul 2002 18:32
89 lines
3792 bytes
Client-side JavaScript has no ability to send an E-mail.

It can attempt to navigate to a "mailto:" URL, but that won't be automated and
will require user intervention to send (assuming it works at all, some users
don't have an E-mail client configured to come up for "mailto:" URLs).

Read the cookie from the server, send the E-mail from there.

Ben wrote:

> Sorry it doesn't have to be CDONTS, I just need the cookie to send an
> email!!
>
> --
> I'm a socialist saving up to become a capitalist.
>
> http://fly.to/bendyer
>
> "Ben" <ben@iow-office.fsnet.co.uk> wrote in message
> news:ahmnhu$cg$1@news5.svr.pol.co.uk...
> > 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

--
| Grant Wagner <gwagner@agricoreunited.com>

* Client-side Javascript and Netscape DOM Reference available at:
* http://developer.netscape.com/docs/manuals/javascript.html
* Internet Explorer DOM Reference available at:
* http://msdn.microsoft.com/workshop/author/dhtml/reference/dhtmlrefs.asp
* Tips for upgrading JavaScript for Netscape 6/Mozilla
* http://www.mozilla.org/docs/web-developer/upgrade_2.html
Technical Details
Message-ID: <3D3EF15E.E473FC96@agricoreunited.com>
Path: arc1-ca.pugleaf.net!archiver1.google.com!news1.google.com!newsfeed.stanford.edu!cyclone.bc.net!news-in.mts.net!news2.mts.net.POSTED!not-for-mail
References: <ahmnhu$cg$1@news5.svr.pol.co.uk> <ahmppv$3ld$1@news6.svr.pol.co.uk>

Show Full Headers
Complete Article Headers
X-Google-Language: ENGLISH,ASCII-7-bit
X-Google-Thread: fb3cb,c1c4460db7d5ea6e
X-Google-Attributes: gidfb3cb,public
X-Google-Thread: 100e17,c1c4460db7d5ea6e
X-Google-Attributes: gid100e17,public
X-Google-ArrivalTime: 2002-07-24 11:26:29 PST
Path: arc1-ca.pugleaf.net!archiver1.google.com!news1.google.com!newsfeed.stanford.edu!cyclone.bc.net!news-in.mts.net!news2.mts.net.POSTED!not-for-mail
Message-ID: <3D3EF15E.E473FC96@agricoreunited.com>
From: Grant Wagner <gwagner@agricoreunited.com>
X-Mailer: Mozilla 4.78 [en]C-CCK-MCD UGG20011025  (Windows NT 5.0; U)
X-Accept-Language: en
MIME-Version: 1.0
Newsgroups: comp.lang.javascript,alive.internet.lang.javascript
Subject: Re: Sending a CDONTS email
References: <ahmnhu$cg$1@news5.svr.pol.co.uk> <ahmppv$3ld$1@news6.svr.pol.co.uk>
Content-Type: text/plain; charset=us-ascii
Content-Transfer-Encoding: 7bit
Lines: 91
Date: Wed, 24 Jul 2002 18:32:16 GMT
NNTP-Posting-Host: 165.23.247.50
X-Complaints-To: admin@mts.net
X-Trace: news2.mts.net 1027535536 165.23.247.50 (Wed, 24 Jul 2002 13:32:16 CDT)
NNTP-Posting-Date: Wed, 24 Jul 2002 13:32:16 CDT
Organization: MTS Internet