Sending email from within a tw

I am looking for a mechanism to automatically send an email from within a tiddler. I want to have any access to my server hosted tw recorded and I think an automatic email is probably the best option.

So when the Start tiddler is opened, an email is automatically sent to a specific email address.

Anyone got any pointers or better ideas? I am not using node.js.

Bobj

I’m pretty sure there is no way to send an email using browser-side (client-side) code without involving a server or a third-party service — for good reasons like spam prevention and security.

If you are looking to track the viewing of your wiki - would Google Analytics which is free - work as well ?. Their setup instructions provides you with the unique script to add to the page - which you can easily add to TW by using the tag $:/tags/RawMarkup and setting type to text/html … FYI - I set this up myself for my site https://ceebee-demos.tiddlyhost.com/

:smiley:

2 Likes

I am so rusty on this - been quite a few years - but would the technique known as AJAX not give you the elements you need? You would need to code up a PHP handler for the XMLHttpRequest object and handle it browser side with Javascript. You say your Tiddlywiki is hosted on a server so perhaps you have the potential to deploy PHP?

See AJAX Introduction

Apologies again if this is not applicable, I don’t really delve into solid coding very much these days so it’s all based on memory.

https://ibnishak.github.io/Tesseract/pluginsandmacros/socialmacros/index.html

Take a look at this macros.

As @Christian_Byron mentioned, this might be from difficult to impossible, without some server help.

But if you’re going to have server help, I would not choose email for this. Why not something like an online spreadsheet? Just add a row with date/time, url/pagename of tiddler, and whatever other metadata you have handy.

But there’s a wrinkle, and there will be with any such solutions. You would either need to (insecurely!) put some secret information into your wiki in order to use the API for these (or for email) or you would need the users to authenticate with some third-party service in order to use this tool. If you do the former, you’re ripping open a huge security hole in your app, and likely violating the terms of service of the API you use. If you do the latter, then how much do you gain for the hassle?

The final option I can think of is to reconsider this:

I am not using node.js.

It would presumably be easy to extend the Node implementation to add this tracking by email, local document or online document. You can securely store your credentials online. I have never tried this, but it does not sound too hard. However, single file to Node.js is a big leap for many.

Thanks @Christian_Byron I will have a look at this. Always happy to not reinvent the wheel

bobj

Here is what it has given me since setting it up yesterday,

Plus it tells me that of the users - most are from Australia and one from Portugal ! … Possibly more to explore here as well

:smiley: