How to send html email with EmailJS - node.js

I'm wanting to be able to send the following HTML code with EmailJS.
<div>
<p>Please click below</p>
<br/>
Click me!
</div>
It says on the EmailJS website that you can send HTML in emails, but there's no example given as to how you do that. All of the tutorials and examples online for EmailJS don't show how to send HTML in an email. If anyone knows how, I'd greatly appreciate the help!
It says at https://www.emailjs.com/docs/faq/can-I-send-html-emails/ that you can create HTML emails, but no example is given. Absolutely none of the tutorials and examples I've come across so far show how to put HTML into an email.

In general, I know that it's not a safe idea to be sending HTML this way, which is why it's hard to find, but just for starters, you can use 3 brackets in your EmailJS template variable, like this, {{{ myHTML }}}. Then, just wrap your HTML tags and content in a string and send that variable on through. It will look odd, but EmailJS will interpret it correctly. I've done small things this way but I've never sent a link this way. It looks a little dangerous to me.

Related

amp selector not working when opening amp-email in Gmail, the tick box section goes off completely

There is something wrong with the tick box thing, using something like <input type="checkbox"> also didn't work with the delivered email
Here is the link to playground for sample snippet
Link to code snippet
Test how it looks on gmail by pasting and sending using Gmail for amp playground https://amp.gmail.dev/playground/

Sending an HTML email with base64 image as part of the HTML

I'm trying to send an email, with HTML content that includes an image tag,
for example:
<img ng-src="data:image/gif;base64,iVBORw0KGgoAAAANSUhEU...gAAASwAAAAmCC" />
unfortunately none of the mail client i'm using support this kind of "src" on image tag.
tried to Google it, it seems as known issue, but none of the answers was good for me.
by the way, i'm using AngularJS to bind the model to the html content, then pass it as an html string
to the WebApi controller, and then send it with an Smtp client.
Hope someone can help me solved this somehow,
Thanks,
Nadav S.
Yes, that is correct. Most clients do not support the "data:" url and even if they do, the size of the binary you can embed is very limited. Barely enough for a thumbnail, not enough for a real picture.
The correct way to do this is with mime multipart/related and the "cid:" url. Then one part contains the HTML and the other part contains the base64 encoded picture. The image part contains a header with a field called "Content-ID". The value is any unique string surrounded by <>. For example:
Content-ID: <xxxyyy>
In your HTML you use the following code:
<img src="cid:xxxyyy"/>
See rfc-2392 for the full specification.

Email Newsletter - Layout goes weird in gmail

I created a newsletter for MailChimp. All looks good when I put it in the mailchimp website.
However when I send a test email to myself, some parts of the layout goes wrong in Gmail.
Some content goes too left and other content goes too right. While the header and some parts at the bottom is in the right place. It looks fine on my Phone.
My Newsletter Code: http://pastie.org/private/cwvosox7nzezqif7r3myoq
A picture of the problem i'm getting in Gmail: http://imgur.com/MPJNJq2
Can you please help me fix how its displayed in Gmail?
Thank you!
It looks like the width of your page is bigger than gmail's div ...
Or kleinfreund idea also have a good point.
edit: I just re-read, looks like this is your own html. Your display problems are directly related to the styles being in your head.
The code that you are displaying above has everything in the head, gmail does not recognize anything between the <head></head> tags.
You will need to move all of your css into inline styles

Gmail is trimming html email content. How to avoid the issue?

Gmail introduced a trimming feature in emails for "better readability". This causes a lot of pain for me, as I have a notification system for email, where I send some html email messages to users. Basically email looks like this:
divs and styling
Object alert in Project by User
tables and tr/td
User Action on Object in Project
/tables and tr/td
/divs and styling
link
footer
To group all emails in one conversation, first email has subject, subsequent emails have Re: subject.
Active users can receive significant amounts of emails like this, but due to "better readability" feature, ALL of the email content (starting from second email) is suppressed.
I am looking for advice - maybe I should redesign my html, or gmail has some anti-suppression code, or just a hack to go around this issue.
Issue from users perspective is described here: http://www.google.com/support/forum/p/gmail/thread?tid=756b83fa60ca1df7&hl=en
I had the trimming problem occurring on a table of an HTML newsletter.
It was very important that the entire table display because it was the
#1 content our client wanted to communicate. Here's the fix, or at least here's how we solved our problem. We eliminated any repetition.
So for this table, the lines in between each row, Gmail was seeing the
lines as repetitive. So I altered the pixel width by 1 px every other
line, which eliminated the repetition and fixed our problem. So that
said, look for repetition, and try to remove it. OR in some cases, you
might have to add type (in white) to create the variation.
Source.
PS: This is a bit unrelated, but I stumbled upon this question while looking for a way to disable the content trimming and keep the conversation view at the same time. I didn't find anything, so I developed a small extension for Chrome and Firefox.
It turns out that there is a very simple rule which causes this behaviour: Gmail will clip the email as soon as it sees the sender (From:) name in the body of the message, regardless of where this appears.
Solution: make sure that that the From: name in your email is not used in the message body (except in the signature, which will probably get clipped!).
This is an awful bug in Gmail, if you're unlucky enough to get bitten by it.
In my case, it was "trimming" an entire message, in a clean thread. See an example here, noting that the "trimmed" content is expanded in the screen-shot.
I ultimately worked around Gmail's bug by removing the entire header you see in that example ("Awesome Home Swap"), including the border below it. I stopped short of actually trying to figure out what specifically was making Gmail confuse that header as a "signature" (though I suspect it could have been the border, implemented using CSS directive border-bottom:1px dotted grey to style the <td> element).
I just found a solution that worked wonderfully for me. Simply create a bunch of hidden unique images throughout your emails to provide uniqueness to parts of the email that aren't actually unique. I'm building my emails with React so I have this Unique components that I'm using pretty much everywhere:
import * as React from "react"
function random() {
return Math.round(Math.random() * 10000000).toString()
}
class Unique extends React.PureComponent {
render() {
return (
<img style={Unique.style} src={`data:image/png;base64,${random()}`} />
)
}
static style = {
visibility: "hidden",
display: "none",
width: 0,
height: 0,
color: "transparent",
background: "transparent",
}
}
One thing I like about this solution is that it doesn't mess up the email preview text that would otherwise happen if you're using hidden text.
Add a double hyphen -- before the collapsed part. I was able to wrap it in a with font color matching the background. Worked for me...
I looked at the emails Gmail sent. Adds the following code (spacer.gif).
I guess this is the solution.
<img alt="" height="1" width="3" src="https://notifications.google.com/g/img/AD-FnEztup4OClDshQhMVXDbi6Oi0lSN-FgEY1jyW384aotccA.gif">
</td>
</tr>
</table>
</body>
</html>

Problem using sendmail activity in workflow sharepoint

I have a breakline problem using sendmail activity in a Sharepoint VS workflow.
I use < br/ > for the breakline, everything is ok in live mail&outlook but when i try it in lotus note all my text is inline.
How can i fix this problem ?
Hate to say it, but you probably can't 'fix' the problem. It sounds like just an HTML rendering bug in Lotus Notes. It doesn't sound like you're doing anything wrong in your HTML if it renders OK in other clients.
You might try changing your HTML code to find something that looks satisfactory in all clients, though. Perhaps add a second <BR /> or use a <P> instead?

Resources