How to insert an emoji into an email sent with GmailApp?

后端 未结 3 1608
夕颜
夕颜 2020-11-30 14:04

I have a GAS script that sends automated emails and would like to include a couple of emojis. I\'ve tried using shortcodes and copying/pasting, but nothing so far seems to h

相关标签:
3条回答
  • 2020-11-30 14:28

    The easiest complete answer that also works with SMS recipients is this:

    function testNewMail() {
     MailApp.sendEmail({
        to: "yourphonenumbergoeshere@mymetropcs.com",
        subject: "Logos",
        htmlBody: "                                                                    
    0 讨论(0)
  • 2020-11-30 14:47

    I tried to copy the emoji (https://www.emojicopy.com/) and paste it directly into the script editor:

    and after sending the email I received it in my mailbox:

    Edit:

    Be careful that some emoji are one character length (like the star) but other are 2 characters (like the smile) for those with 2 characters you can think of writing immediately after the smile but instead you are writing inside the smile so you break it therefore turns in question mark.

    If you try to run this code, you will see that the first has length 2 and the second one has length 1:

    If you try to move the pointer (in the apps script editor) on those 2 emoticons, from before to after the emoticon, you will see that in the case of the star just one step but for the smile you need 2 steps.

    0 讨论(0)
  • 2020-11-30 14:50

    You want to send an email with HTML body including the emoji. If my understanding is correct, how about this modification?

    About GmailApp and MailApp :

    • Unfortunately, GmailApp cannot use the recent emoji characters. At GmailApp

      • emoji less than Unicode 5.2 can be used for this situation.
      • emoji more than Unicode 6.0 can NOT be used for this situation.
    • MailApp can use all versions of emoji.

    "⭐" is Unicode 5.1. But "

    0 讨论(0)
提交回复
热议问题