MailMason create plain-text only email template - postmark

Currently, in mailmason a template with no Layout set, fills both HTML and Text versions of the email template in postmarkapp.
How do I create a template in mailmason so the HTML field in postmark will be empty, and Text set?
It's important for creating small size ticket emails without bloating customer service management software.

I solved it:
https://github.com/wildbit/mailmason/issues/45#issuecomment-577557594
This is a very dirty workaround, I hope to see this feature in the repo

Related

Django (hard question): How to allow users to write text and insert specific tags/variables that my app will then fill with values on the BE

This is an hard one (I think).
I have a django app and I am trying to build a specific editor tool to help users write email templates.
Basically, a user should be able to write simple text for an email but also insert tags/variables in specific spots that will then be filled with values. Almost like if they were create a django template.
So imagine that a user would write something like:
" Hi, <employee name>
I am very happy to inform you that you have been confirmed for the position of <position name> for the upcoming <project_type> <project_name>...."
And on the backend I would transform that into:
" Hi, Mike
I am very happy to inform you that you have been confirmed for the position of Product Designer for the upcoming feature film Titanic...."
Currently I have a solution where the main structure of the email is the one I built and users can't really change it. (So it's just one template) but I would like to allow users to create their own templates. How can I do it?
Fixed this using dev exrepress variables html editor
https://js.devexpress.com/Documentation/ApiReference/UI_Components/dxHtmlEditor/Configuration/variables/

Django/Wagtail - Dynamically generate choices based on uploaded document

I am trying to implement a Chart Block in Wagtail where a user can upload a spreadsheet via the DocumentChooserPanel and then a chart is generated based on the data in that spreadsheet.
I currently have it functioning, but the user must explicitly specify the variable they want the chart to be based off of:
class ChartBlock(blocks.StructBlock):
data_file = DocumentChooserBlock()
primary_variable = blocks.CharBlock(required=True,max_length=255)
class Meta:
template = 'dataviz/blocks/Chart.html'
icon = 'cogs'
label = 'Chart'
I was wondering if there is any way to have the primary_variable field dynamically populated with the column headers from the spreadsheet uploaded and stored in Documents - so that the user would be able to choose from a list of available variables instead of having to remember what a variable was called.
Thank you so much!
This wouldn't be easy to achieve with a vanilla implementation of Wagtail.
The page edit form is generated on page load, including the population of choice lists. I'm pretty sure that the same is true of choice lists in StreamField blocks, that they are populated as the block is added.
The code for this hangs between wagtailadmin.edit_handlers, wagtailadmin.views.pages and wagtailcore.blocks. It would be a pretty complex customisation.
Another possible route for investigation would be using the insert_editor_js hook to update the primary_variable field once a document was uploaded. However, I'm not sure you'll find a dependable ID to hang an event listener off of.
However, you will soon be able to custom validate the submitted page. A PR has just been submitted to allow this custom validation. That should reduce the amount of user error when adding the primary_variable.
This feature should be available in Wagtail 1.4, which I believe is due for release pretty soon.
I hope that helps.

How to insert current date time into a Sitecore email template

I have a form with an Send Email action. I'm about to use the field placeholders, but I'm not sure if its possible to use ASP like syntax to print out the current date time etc.
Is this possible with Sitecore? Or do I need to add an additional field and make it invisible?
So, if I understand your questions correctly:
You have an email template which will have fields in it. You need to store current date time in that field?
You can do that my injecting a pipeline when item is getting created and store the current date time to that field. There are various sources where you can find out how to intercept between pipelines in Sitecore.
Hope it helps :)

Should I remove all CSS while sending HTML emails in Django?

I have a Django-powered WebApp that occasionally needs to send pretty HTML emails to my users.
I'm learning how to send HTML emails using Django. Here are the instructions I'm following. They are quite simple and good: http://www.djangofoo.com/250/sending-html-email
By following these instructions I'm able to send HTML emails. However, the emails I want to send should share the styles and look-and-feel of my webApp of course. Each Django template on my website includes a bunch of CSS at the top that ensures a consistent look. However, when I simply send that template as and HTML emails, the styles do not kick in in the email. Does CSS not work while sending HTML emails through Django?? Do I need to manually and explicitly set the fonts, colors, bold, italics, of each element in the HTML template I would like to use for the email? How do other people do this?
CSS is very difficult to get right with html emails... The general rule is to use inline styles and try to stay as basic as possible.
This SO question has some good resources in it for guidance on designing html emails.
Instead of manually setting all styles in the email, I tend to use the same CSS styles as the site if I want emails that should be pretty. However, emails need the styles inlined, and for that I use the inlinestyler module, which will take the HTML and the CSS files and set the relevant styles inline before sending the email.
There are still some things to think about, if you are careless you get gigantic emails because you use big style settings everywhere, and many email clients will not do positioning correctly etc. so you may have to make custom CSS styles for your emails anyway. But even if you do, inlinestyler is useful, as you get much more maintainable emails with the CSS and the HTML separate.
CSS is supported by some email clients, and not supported by others. Some clients support inline styles and others do not. You can see a fairly verbose list here. Most of what can be done with HTML/CSS can be done with inline styles and (gasp) table layouts, but some of it is simply impossible. Tools like the one #Lennart mentioned are invaluable, but "just inline everything" doesn't accommodate for a number of issues. (Pseudo classes comes to mind as a major point (a:hover is supported by Outlook, while .classname:hover is not), as does background image (there is a hack to make that work though)).
I guess that my basic point is that you can try to shortcut the process by using inlinestyler or similar, but you are going to need to keep a separate set of files, and you'll definitely be doing a series of manual tweaks.
I think you will find that email clients will not retrieve the css.
Instead, in your email, put the contents of your CSS files directly into the email, with <style> and </style> around it.

Dreamweaver nested templates

So I'm trying to achieve something like this in Dreamwaver CS5. I have one optional editable region (optional because I do not want that thing in certain webpages) and another editable region in my "master" template. So what I'm doing now is to create a new template from my master template, and then change the optional editable region to be displayed, saving it as a new template, and finally creating new webpages from the new template.
Unfortunately, it seems everything that was editable in the new template is editable in the new webpage I just created. I want only the non-optional editable region in the master template to be editable in all new webpages created from the new template. How can I accomplish this?
It's annoyingly simple (and kind of strange).
In the second-level template, add this expression: ##("")## anywhere in the editable region you want to lock. Now all pages derived from that template will display it as non-editable.
You can do some fun things with Dreamweaver's template expressions and variables, but finding any real documention has proven difficult. Mainly because it's essentially useless if you can use PHP. And it took some time figuring out that ##(lang!="fin"?(lang=="swe"?"Swedish title":"English title"):"Finnish title")####(sub!=""?" :: "+sub:sub)## was the specific expression i wanted for a non-PHP client's page title. So, yeah.
When you add a new editable region in an editable region passed through to the nested template, the highlighting color of the editable region changes to orange. Content you add outside the editable region, such as the [blah], is no longer editable in documents based on the nested template
source
http://help.adobe.com/en_US/dreamweaver/cs/using/WScbb6b82af5544594822510a94ae8d65-7aa1a.html