OiO.lk Community platform!

Oio.lk is an excellent forum for developers, providing a wide range of resources, discussions, and support for those in the developer community. Join oio.lk today to connect with like-minded professionals, share insights, and stay updated on the latest trends and technologies in the development field.
  You need to log in or register to access the solved answers to this problem.
  • You have reached the maximum number of guest views allowed
  • Please register below to remove this limitation

How to use Emoji in email subject using Google Apps Script?

  • Thread starter Thread starter Ravgeet Dhillon
  • Start date Start date
R

Ravgeet Dhillon

Guest
I am trying to send out an email using Google Apps Script.

Code:
// try 1
const subject = 'Hello World 😃';

// try 2
const subject = 'Hello World ' + String.fromCodePoint('0x1F600');

GmailApp.sendEmail(
  '[email protected]', subject, '',
  {htmlBody: '<p>Hello World 😃</p>', name: 'ABC'}
);

When I use a ⭐, it works perfectly in both subject and HTML body. However, when I use 😀, it shows black diamonds with question marks in both subject and HTML body.

I have also checked How to insert an emoji into an email sent with GmailApp? but it only showcases how to use it in the body of the email, not the subject.

I have tried using MailApp and it worked but I don't want to use it for some reasons.

Any idea on how to solve this?

<p>I am trying to send out an email using Google Apps Script.</p>
<pre class="lang-js prettyprint-override"><code>// try 1
const subject = 'Hello World 😃';

// try 2
const subject = 'Hello World ' + String.fromCodePoint('0x1F600');

GmailApp.sendEmail(
'[email protected]', subject, '',
{htmlBody: '<p>Hello World 😃</p>', name: 'ABC'}
);
</code></pre>
<p>When I use a ⭐, it works perfectly in both subject and HTML body. However, when I use 😀, it shows black diamonds with question marks in both subject and HTML body.</p>
<p>I have also checked <a href="https://stackoverflow.com/questions/50686254/how-to-insert-an-emoji-into-an-email-sent-with-gmailapp">How to insert an emoji into an email sent with GmailApp?</a> but it only showcases how to use it in the body of the email, not the subject.</p>
<p>I have tried using MailApp and it worked but I don't want to use it for
some reasons.</p>
<p>Any idea on how to solve this?</p>
 

Latest posts

Online statistics

Members online
0
Guests online
5
Total visitors
5
Top