0

We have been using the GMAIL Restful APIs to send emails. However, recently we have been receiving requests for support to send emails to non-ASCII email addresses.

I was able to use RFC2047 (Mime-encoded word) to properly encode the subject and the "from" email address headers. But using the same method for the "to"-recipient email addresses failed.

So my questions are :

  1. Has anyone successfully sent emails to non-ASCII recipients using GMAIL RESTful APIs?
  2. Or do we have any documentation i can read on how i can do this using the restful apis?

Thank you so very much for your time and I apologize in advance if this is a duplicate somewhere.

Linda Lawton - DaImTo
  • 106,405
  • 32
  • 180
  • 449
GovZ
  • 253
  • 1
  • 11
  • Hi ! Do you have an email address where you can test this? According to this other [Stack Overflow answer](https://stackoverflow.com/a/27698924/12835757) you can use the API to send messages with body, subject and to my understanding address of non ASCII characters if you encode the header. Let me know if this has helped you clarify your issue :D – Mateo Randwolf May 21 '20 at 08:00
  • Great question @MateoRandwolf. I am working on that for now, looking for a mail provider that supports non-ASCII characters. The way I test this right now, is via checking my sent folders. In your experience, have you seen a mail provider that supports non-ASCII characters? once I find one, I will share with you. – GovZ May 22 '20 at 02:29
  • I believe you can with Yandex create an email with a non ASCII subdomain according to [this blog post](https://ivangrigoryev.com/en/sending-email-to-non-ascii-character-email-address/). According to [this other Stack Overflow answer](https://stackoverflow.com/a/52133890/12835757) and what I have shared previously, it seems the only way to send an email to these addresses is to encode the string as you would do with a non ASCII subject. Would you be interested in a more in depth answer using this workaround? – Mateo Randwolf May 22 '20 at 11:01
  • @MateoRandwolf sorry for the late reply. I had been working on a couple of stuff lately. I will check out yandex once i get some slack. As for a more elaborate answer, yes definitely. It would be awesome to share ideas how to tackle this. – GovZ May 26 '20 at 14:28

1 Answers1

0

Workaround

This answer is posted as Community wiki as it is sourced be two great Stack Overflow answers on the topic.

At the moment of this answer, Gmail and other mailing services are still transitioning from only supporting ASCII characters to support UNICODE characters in the email addresses and subject forms. Therefore, you will need to encode your email address string in base64 to be able to send the emails.

This stack overflow answer clearly details everything related to how the domains and names of email addresses are being interpreted by mailing servers and the workaround to be able to send a email programatically to these addresses.

If you want a more specific Gmail API answer, this other Stack Overflow solution explains how you should encode your string to be able to send these non-ASCII emails.

I hope this has helped you. Let me know if you need anything else or if you did not understood something. :)

Mateo Randwolf
  • 2,823
  • 1
  • 6
  • 17
  • thank you for the workaround. This is actually what I am doing right now. I think this is the one specified by RFC2047. I also tried to create a non-ascii mail using yandex but it seems it is not capable now. https://imgur.com/a/UU35xI1 Thank you very much for all the assist. I can't upvote yet but will do once my reputation allows me. Aside from yandex do you know of other mail services? thanks again – GovZ Jun 01 '20 at 02:23
  • Hi! I found [this site](https://ivangrigoryev.com/en/sending-email-to-non-ascii-character-email-address/) with some more providers but not sure if they willl support non-ASCII. – Mateo Randwolf Jun 01 '20 at 07:12