Hi Tony

Am Dienstag, 2. Juli 2019 01:16:52 UTC+2 schrieb TonyM:
>
> Stephen,
>
> Welcome back, if you can share your ultimate result that would be great.
>

I will. I already have something working and wil describe it, as soon as I 
have time :/ extensively. But here is what I do just roughly sketched out.

1. Create one or more Mailtemplate Tiddlers. Each tiddler has to have:
   1. The Mail text in the text-field
   2. a subject-field
   3. a recipients-field
   Each field may contain <<VARIBALE>>s to fill in. So you can, if you 
want, provide recipients or (part of) the subject and text by setting a 
variable.
2. have the mailto-tiddler (see below)
3, use the mailto tiddler like this
<$set … define your variables>
{{Mailtemplate Tiddler -- Linktext||mailto}}
</$set>
and you will get a link called "Linktext" which should open a pre-filled 
Mail ready to be sent.

Full example

Tiddler "Mailtemplate Customer ready"
Hi Team.
 
Please be informed that I've created.  Customer <<Customername>>.
 
Best Regards,

field "subject": "Cusomer <<Customername>> created
field "recipients": "[email protected]"
I prefer to set the tiddler's type to text/plain to be able to see all 
variables


Tiddler using it
Customername: <$edit tiddler="Customerdata" index="name"/>
<$set name="Customername" tiddler="Customerdata" index="name">
{{Mailtemplate Customer ready -- Inform the team||mailto}}
</$set>
Note: The example will create a dictionary tiddler "Customerdata".


Tiddler: "mailto"
\define mailto()
<a 
href="mailto:$(recipients_encoded)$?subject=$(subject_encoded)$&body=$(body_encoded)$">$(linktext)$</a>
\end

<!-- separator used between tiddler and linktext -->
<$set value=" -- "
  name="sep">

<!-- extract the tiddler's title-->
<$set select="0" filter="[all[current]splitbefore<sep>removesuffix<sep>]"
 name="tiddler">

<!-- extract the linktext -->
<$set select="0" 
 filter="[all[current]removeprefix<tiddler>removeprefix<sep>]"
  name="linktext">

<!-- get the mail template's text -->
<$set tiddler=<<tiddler>> field="text"
  name="body">

<!-- get the subject from the subject field -->
<$set tiddler=<<tiddler>> field="subject"
  name="subject">

<!-- get the recipients from the recipients field -->
<$set tiddler=<<tiddler>> field="recipients"
  name="recipients">

<!-- wikify the text to resolve all used variables -->
<$wikify text=<<body>>
  name="body_text">

<!-- wikify the subject to resolve all used variables -->
<$wikify text=<<subject>>
  name="subject_text">

<!-- wikify the recipients to resolve all used variables -->
<$wikify text=<<recipients>>
  name="recipients_text">

<!-- encode the text -->
<$set select="0" filter="[<body_text>encodeuri[]]"
  name="body_encoded">

<!-- encode the subject -->
<$set select="0" filter="[<subject_text>encodeuri[]]"
  name="subject_encoded">

<!-- encode the recipients -->
<$set select="0" filter="[<recipients_text>encodeuri[]]"
  name="recipients_encoded">

<!-- create the link -->
<<mailto>>

</$set>

</$set>

</$set>

</$wikify>

</$wikify>

</$wikify>

</$set>

</$set>

</$set>

</$set>

</$set>

</$set>


I'm still working on it, but maybe this is already useful to you.

-- 
You received this message because you are subscribed to the Google Groups 
"TiddlyWiki" group.
To unsubscribe from this group and stop receiving emails from it, send an email 
to [email protected].
To post to this group, send email to [email protected].
Visit this group at https://groups.google.com/group/tiddlywiki.
To view this discussion on the web visit 
https://groups.google.com/d/msgid/tiddlywiki/e4741d79-d4e1-4465-9c3a-0388764c5051%40googlegroups.com.
For more options, visit https://groups.google.com/d/optout.

Reply via email to