Best way to send a posh e-mail

Hi,
I have just used change nodes to put my temperature values into global variables, and managed to get my smtp gmail account working ie sending emails, my goal really is to send an email with a coloured background a picture on the top and text containing the values of the variables, i have had a look at UI builder but not sure if I could use it for this ?, is this called a formatted email ?, any ideas on the easiest way to achieve this please

Thanks
Stuart

You can send html, with colour and everything else (read the built in help).

Also, try searching the forum, I'm certain there are examples.

Hi,
I don't think it is possible to send an email with a picture in it unless the the picture is on an online server somewhere, as far as I can see you are stuck with fonts and colours, if anyone could confirm this I would be grateful.

Thanks
Stuart

No, you can add attachments that can be referenced OR you can add images with a data URI.

As an attachment: Help formatting an image as an email attachment using Nodemailer - #5 by Steve-Mcl

As inline:

There are more (use the forum :magnifying_glass_tilted_left: search for things like email html image etc)

2 Likes

Hi Steve,
I will have a read

Thanks
Stuart

Hi,
I notice that Totally says why don't you just put the url in your email of the image, so could the url be a local address ?

Thanks
Stuart

No, using a url it would have to be accessible the receiver of the email.

1 Like

Hi Colin,
Yes, been reading stuff about this all afternoon, Steves link shows how to turn the image into Base64 which I did and outputted the code but when i use the code in my email it displays nothing, I think I have confused things slightly by using the MJML node and their own styling, I have managed to cobble togethor an email using node-red global variables which gets sent every day, but I will keep on trying the picture route as I would like to put a little logo on there, when I search for Base64 and MJML not much comes up and it seems that it is frowned upon as it can cause emails to not be received, also people are saying that the base64 images are not showing in Gmail which is what I am using.

Thanks
Stuart

Hi, there are a few things to think about when using HTML formatted emails.

First is that not all email clients support all HTML formatting. So what you send isn't always what the receiver will see. Try to stick to safe tags where you can. URL's are generally NOT safe tags to an email client and most clients won't show the image without additional user intervention.

Second is that most email servers have message size limits so you do need to be somewhat cautious about including images.

Ah, just read your bit about using gmail. I'm afraid that Google Mail is NOT a proper, standards compliant email client.

Amongst other things, it will not display images using data URI's.

I've left the rest below as I'd already written it. Might be useful to someone.


Others are correct to say that you can use data URI's to include images and I do that in my own work email signatures. I currently have 2 in fact. One for the work logo and one for the BCS logo.

There are, of course, plenty of online image converters to do a one-off test or a one-off conversion of your logo: convert image to data uri - Brave Search

There are also npm node.js packages you can use with Node-RED: npm convert image to data uri - Brave Search

Note that the data URI src attribute should not have an line breaks in it.


As for using UIBUILDER to help. It won't really help with converting the image of course. However, you could use it to build the HTML if you wish to, it has the uib-html node that will convert the no-code/low-code node outputs to full HTML that you can then use in an email.