Mandrill - Rules overriding with blank html content - mandrill

I am very new to Mandrill and whilst trying to use the Rules Engine (via SMTP integration without using Headers, with the incoming email being text), I have configured an open rule that states:
if
sender's email matches scott***#****.com
then
set template to TestTemplate using template block body
but instead of the incoming message being inserted into the body block, as per the following html that's in the TestTemplate
<div mc:edit="header">
<h2>Testing Testing</h2>
</div>
<div mc:edit="**body**" style="color:#000000;">
<h2>123 123</h2>
</div>
<div mc:edit="footer">
Company contact information will go here.
</div>
The 123 123 is being overwritten with blank content i.e. not what's being passed in on the original email message
Any ideas?

Related

Adding a hyperlink to 'Mailto' Body text

I am currently working on mailchimp to produce an email forwarding button. When you press this button some text appears in an appear which you then send to others. I have used the code below. I want to have a hyperlink for the "www.dailypnut.com" address as currently it appears in the email as just text. How do I do this?
<p style="background-color:#3b5998; width:200px; height:40px;
opacity:0.8;margin:auto;margin-top:15px; margin-bottom;px;
text-align:center;line-height:40px"><a href="mailto:?Subject=The Daily
Pnut:The World in a Nutshell&Body=%20Sign%20up%20for%20the%20
Daily%20Pnut.%20A%20humorous%20daily%20summary%20of%20world%20affairs
%20-%20www.dailypnut.com" style="text-decoration:none"><b style=
"color:white;text-decoration:none; opacity:0.9;text-transform: uppercase;
font-size:14px">Forward the Pnut!</b></a></p>
This behaviour depends on the e-mail client, so you won't get a solution for this in your html.
Unfortunately you can only specify a plain body in mailto (see for example MailTo with HTML body). Since a lot of e-mail clients today only allow editing of the html body, and hence 'convert' the plain body into html when it is loaded, they will most likely replace URLs with links during conversion.
The result is that the behaviour of your mailto link will be different depending on the user's email client.

Rails confirmation email aol parsing error with email name

When I get a confirmation email sent via my rails app, I use this code
<a href='mailto:John%20Doe<Johndoe#random.com>?subject=Billing%20Submission'>LINK</a>
The email that shows up in all different emails is good except for aol.
In aol, it shows up as:
?subject=Billing%20Submission'>LINK
Is there any way around this without compromising the name being added?
Replace
<a href='mailto:John%20Doe<Johndoe#random.com>?subject=Billing%20Submission'>LINK</a>
With
<a href='mailto:John%20Doe%3CJohndoe#random.com%3E?subject=Billing%20Submission'>LINK</a>
> after Johndoe#random.com was actually ending the starting tag of a (anchor).
Use URL encoding equivalent for < (%3C) and > (%3E) sign.

Thymeleaf - Configure mail subject in template

I am using Thymeleaf templates for generating email contents and send using spring mailSender. Is there any option to specify the email subject within the thymeleaf template itself?
You can define fragments in your template and render those parts only.
<div th:fragment="subject">
Mail subject
</div>
<div th:fragment="body">
Mail body
</div>
That's a basic HTML thing
Send mail
you can add also the ?body= if you want to add content in your mail.
Edit: According to your comment, you want to put a input on a page and write a subject and get it in Java.
Put a form with an input in your thymeleaf template and post it to your server, get the value in your controller and use it to send your mail.
Do you need code example for this ?

escape html twice in Rails

I am using Bootstrap tooltips for displaying user generated content. But i also use the option html: true because I want to enable html in the tooltip to be able to use some formatting.
Let's say i have a user content as follows:
<script>alert('e')</script>
It is escaped server side, put into the title attribute of some div, and sent to the browser like this:
<div title="<script>alert('e')</script>">Bla</div>
But the browser will unescape the html entities, and when i call the tooltip function on the div, it will have the following title attribute value:
<div title="<script>alert('e')</script>">Bla</div>
Which will cause the alert to be fired. So what I would need is to escape the content of the title attribute twice, so that it's sent like this:
<div title="&lt;script&gt;alert('e')&lt;/script&gt;">Bla</div>
And when tooltip is called, it would still look like this:
<div title="<script>alert('e')</script>">Bla</div>
So the alert would not be executed.
What is the proper way to do this in Rails? Is there something I am missing here? Please don't tell me to use the option html: false of the tooltip module as I need html formatting.
I would try for HTML:
<div title="<%= escape_javascript("<script>alert(\"e\");</script>") %>">Bla</div>
However I wonder why you want to allow users to inject script tags into the tooltips?

How to put a button to action in an email template in RoR

My application sends notification emails to users, I would like to put a button in the email that links to a certain action in a controller?
When I put regular html code (like <input type="button" .... />, I get it in the received email as string, that is, I find the html code in the email) How can I skip this trap?
It's not a perfect idea to send messages as html. By default I turn off html in my email account.
Look this screencast for a beginning: http://railscasts.com/episodes/206-action-mailer-in-rails-3. You just need to specify different view formats: html or text for plain text. But in any case it will rely on reciever email settings which format will be choosen.

Resources