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.
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.
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.
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.
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.
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.
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).
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.