How to remove 'View Entire Message' option in gmail sent using sendgrid - gmail

In my current project, we are sending some user chosen services to the mail address provided in input.
We are using a HTML file to format the services and copying this html template to 'mail.Body' before sending the email.
The emails are sent using Sendgrid
When recieving this in gmail ,only for some clients (Set-A) ,even for short email '[Message clipped] View entire message' is shown at the bottom of the email.
We use similar html template to send it for different clients(Set -B), but '[Message clipped] View entire message' is NOT DISPLAYED in this mail ,even when the email is longer.
Tried minified HTML template , but still 'View entire message' is shown at bottom of gmail for only Set-A clients.
The HTML file size before copying to mail body for Set-A (40.11KB) is smaller than that of Set-B (49.09KB).
So I am assuming size is not the problem for this
I compared both the HMTL templates, no difference in styles or other HTML tags. Just the text content is different.
Kindly advise how to avoid this 'View Entire message' option being displayed.

For me it had to do with the character set of the email body. Email body "Hej på dig!" and "Content-Type: text/plain; charset=UTF-8" would reproduce the bug.
You need to make sure that the email body is indeed encoded as declared (check using "show original"). After converting the body from ISO-8859-1 to UTF-8 the problem went away.

Related

MimeMessage shows empty body in email in C#?

I want to show html body in mail, I was sending mail through SMTP server using windows service. I write the request in a file & pass this file to MIME.Load() method to read that file and extract the data from that file, but here I get body in plain text format, & so empty body shows when actual email sent. I code for this as below, I use C# for coding
var message = MimeMessage.Load(emailFile);
I have html body but when I checked this message it gives me only plain text and does not shows its html version. I don't understand here how to set or change plain text body to html body in Mime. Does anyone knows about the solution. Thanks

Tabular format data in node js email

in my node js project, I am using gmail to send mail, mails are going fine, except that when I put data in tabular form with HTML code then rather printing the data in tabular form, it simply prints the html code.
what am I missing here, should I user any specific npm, as of now I am using nodemailer.
You might be writing the HTML code in the text field. Use nodemailer's html field
var mailOptions = {
html: '<b>Hello world!</b>',
}
and write your HTML code into this field.

base64 images not displaying in Outlook when using ejs + emailjs

I'm using a mix of ejs and emailjs to send out emails in my node.js app when various events happen. I'd like to embed a base64 image (a small logo) into the email when it sends, but both Outlook and Gmail (plus Inbox by Google) fail to render the image.
I'm using this bit of code to find the mime type of the image and put together the base64 string:
MyApp.prototype.ImageToBase64 = function(image) {
var mime = require("mime")
file = fs.readFileSync(__dirname + "/images/" + image, { encoding: 'base64'})
return 'data:' + mime.lookup(image) + ';base64,' + file;
}
That works great, because I'm able to copy and paste that resulting string right into my browser and see the image. But when I send the email via emailjs, Outlook converts the +s to +. When I "View Original" in Gmail, the base64 is split up into 'chunks'. Each chunk is on a newline and each line ends with a =. If I take Gmail's version and remove the = and newline then paste it into my browser, the whole picture loads perfectly, but it just refuses to load anywhere else, regardless of whether the user is in my contact list or not.
Here's the code I'm using to send the email:
// Host, username, password and SSL (false) all set above here
server.send({
text: myTemplate,
from: "me#example.com",
to: "someone#example.com",
subject: "Testing",
attachment: [
{data:myTemplate, alternative:true}
]
})
And the template looks like this (truncated, as the other bits aren't important):
<body>
<p><img src="<%- ImageToBase64("logo.png") %>"></p>
<h1><%= Name %> has been triggered</h1>
<p><%= Name %> has been triggered. It was triggered on <%= TheDate %></p>
Any hints?
EDIT: I tried setting the headers in the "attachment" property, but with no luck
Outlook uses Word to render the images, and Word does not support embedded (src="data:image") images.
You need to attach the image as a file and set the Content-ID MIME header to the value matching the cid attribute on the image (<img src="cid:xyz">) in the HTML body.
Okay, so even though this answer is from 2013, it seems like the wisdom still holds true, in that base64 image support sucks in email clients.
Basically the only mail clients that still support inline images are either older ones (e.g. Office 2007), or Apple / Android's default mail apps.
While that's a bit disappointing, it's not the end of the world, as the email will only be seen by people on the same network as my app, so I can just point to the image hosted on the web portion of the app.
But for anyone else trying this, host your image on an image sharing site like Imgur or on your own server and use a regular ol' <image> tag to display it.
So much for self-contained emails, right?

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.

xpages forward o reply email

I need a solution, that when you press a button from a inbox xpages mail message, the new xpages is composed with the body and image and attachment of original inbox message (ckeditor control)
I nave found a Solution for passing HTML to ckeditor but not for attachment and inline image.
Have you any suggest?
P.S. the solution will need work in on-fly mode (without savind document before..so that when you foward an email with a classic webmail)
See my answer below on how to copy contents and images to a CKEditor on the fly:
https://stackoverflow.com/a/19328276/785061

Resources