I am sending HTML emails with explicit HTML attribute and style to make the text RTL. But gmail seems to strip it out completely.
Example email body (HTML)
<html lang='he-IL' xmlns='http://www.w3.org/1999/xhtml'>
<head><meta name='Content-Language' content='he-IL' /></head>
<body align='right' dir='rtl' style='direction: rtl; text-align: right;'>
<small><i>הודעה זו נשלחה ב25/11/24 20:11 (IL)</i></small><br>המערכת ניסתה לקבוע בשבילך שיעור לזמן הרגיל שלך (יום שישי, 2024-12-06 14:40 (IL)) אך אין מספיק כסף בחשבונך. נא בבקשה להכנס ל <a style='color: #555555 !important; font-weight: bold;' href='https://gameready.co.il/pay/?student=Alon.Portnoy'>https://gameready.co.il/pay/?student=Alon.Portnoy</a> או ליצור קשר עם שירות לקוחות אם לדעתך משהו לא תקין<br>כדי להשבית התראות דוא`ל כמו זו, עבור אל <a href='https://gameready.co.il/settings' style='color: #555555 !important; font-weight: bold;'>ההגדרות</a> שלך.
</body>
</html>
If i render that code with a browser it correctly displays the RTL and alignment:
But the gmail recipient sees LTR text and aligned to left , indeed by looking at the HTML received by the recipient , it seems that the RTL and right alignment directives have been stripped out completely.
Why is this? How to make it RTL? Thanks
EDIT: emails are sent automatically by code , not by gmail interface.
I came across the same issue.
Gmail strips the email's html
and body
, so you will need to add dir=rtl
to the main element within the body as well.
Your can wrap your content in an element and give that the dir
attribute.
Something like the following may work (my emails' main element is a table
):
<html lang="he-IL" xmlns="http://www.w3.org/1999/xhtml">
<head>
<meta name="Content-Language" content="he-IL" />
</head>
<body align="right" dir="rtl">
<div dir="rtl">
<small> <i>הודעה זו נשלחה ב25/11/24 20:11 (IL)</i></small>
<!-- etc -->
</div>
</body>
</html>
As a side-note, email clients do not support all of the modern features of the web. A lot of the layout is done, alas, using old-fashined tables.
A good source for feature support by email clients is Can I email.