OT: send nfo from site?

I want to send the equivalent of an e-mail with javascript derived data as the body - BUT WITHOUT need of any e-mail client on the user side. In a HTML page, i can add: browzr=navigator.userAgent; // Agent is unique for our purposes document.writeln(browzr+"|"); And see the agent string on the screen. Now, i would like that string to be in the message of an e-mail i would find after logging into one of my web-mail accounts. NO filling out forms, NO "submit" junk, just a direct symple data transfer.

Help?

Reply to
Robert Baer
Loading thread data ...

side.

purposes

Actually is not at all that hard. Your java script send an email tool just needs the submit button stuff removed, the email header fill in adapted suit your needs, the script output inserted automatically by calling the generating script, and transmit to your favorite email address. How good are you at writing java script? If the output size is small you can do this as an SMS as well.

?-)

Reply to
josephkk

Thanks. Are you saying that the "submit" part is not needed? Then what "triggers" the sending?

Reply to
Robert Baer

As far as I can tell, you can't send mail from javascript other than by starting up the user's mail client.

I solved the problem by using Ajax to run a server-side PHP script that then sends the actual email.

Jeroen Belleman

Reply to
Jeroen Belleman

if you're not doing it client side, you need to do it server side,

basically you need to cause the page to issue a request to the server that contains the info you want and have the server store that data. this could be the same server or a different server.

browzr=EncodeURI(navigator.userAgent) document.write("");

foo.gif could be just an ordinary file, you can ge the info you need by looking at the server logs.

--
umop apisdn 


--- news://freenews.netfront.net/ - complaints: news@netfront.net ---
Reply to
Jasen Betts

that reads like he misunderstood the question.

forms with mailto: actions alwys requre the user to hit do the sending of the email if it it weren't so we'd be seeing lots of spam from them.

you've got to send the data to a server and deal with it there. I suggested one minimalist method if you can't do any server side scripting.

--
umop apisdn 


--- news://freenews.netfront.net/ - complaints: news@netfront.net ---
Reply to
Jasen Betts

You must know something that the rest of us don't. Javascript deals with local data within the browser. There is no local email and/or socket API and you cannot touch local files either. That's why they invented Java to do it at the server side.

I would say no to this.

The html mailto tag startup the email client, not really javascript.

Yes, in response to a POST, GET, etc., with some kind of button.

Reply to
edward.ming.lee

If you want to capture some data and send it without any user interaction you can use a onLoad() or similar capability and a Ajax connection. The other option is a button the user clicks. The button action would call your send email via POST function. Both would POST back to the web server that would handle the actual email generation.

There might be some JS libraries that would allow you to talk directly to a webmail api interface. I have never tried them. You could talk directly to a SMTP server but there is a whole boat load of security and cross domain issues you would have to deal with.

Just setup your server to accept a POST with what you want to email. BUT - you have security issues to deal with. Once I capture that traffic locally and see I can "seem to send a email with a POST" I'm gonna try and start sending spam with it. You might do a one time token or something like that.

--
Chisolm 
Republic of Texas
Reply to
Joe Chisolm

...and, of course, that means the button must be clicked; so the sending CANNOT be fully automated.

Reply to
Robert Baer

No button needed.

You load a page that contains a bit of Javascript that asks for a server-side script via Ajax. The script then sends the email. Apart from the user loading the initial page, no further user action is required.

Below a simple example, composed of two little files without any safeguards against misuse. Save the first as 'mailer.php' on your favourite PHP-enabled web site, and the second under any name.html you please in the same directory. Load name.html and it should show 'Mail sent' if all goes well. You should get the actual mail some instants later.

Jeroen Belleman

======================== mailer.php ================

====================== name.html ============= &nbsp /* * Ajax script to load bits and pieces of HTML */ function loadDoc(doc,dest,postdata,postloadfunction) { var xmlhttp; if (window.XMLHttpRequest) {// code for IE7+, Firefox, Chrome, Opera, Safari xmlhttp=new XMLHttpRequest(); } else {// code for IE6, IE5 xmlhttp=new ActiveXObject("Microsoft.XMLHTTP"); } xmlhttp.onreadystatechange=function() { if (xmlhttp.readyState==4 && xmlhttp.status==200) { document.getElementById(dest).innerHTML = xmlhttp.responseText; if (typeof(postloadfunction) == 'function') setTimeout(postloadfunction,30); } } xmlhttp.open("POST",doc,true); xmlhttp.setRequestHeader("Content-type", "application/x-www-form-urlencoded"); xmlhttp.send(postdata); return xmlhttp; }

loadDoc("mailer.php","confirmation","data=something");

Reply to
jeroen Belleman

Baer

side.

purposes

is

No user click on a submit button is necessary. Just send the message to the mail delivery program. Do not forget to have it fully formatted compliant with the RFCs (100 % available online for free).

?-)

Reply to
josephkk

tool

size is

The way i read the question is that this is a server side script, java or not, and you can compose and send email from server side scripts.

?-)

Reply to
josephkk

ElectronDepot website is not affiliated with any of the manufacturers or service providers discussed here. All logos and trade names are the property of their respective owners.