email-bugs icon indicating copy to clipboard operation
email-bugs copied to clipboard

Gmail mobile removes breaklines when opened from a mailto link

Open Luwangel opened this issue 5 years ago • 6 comments

I want to pass a body containing break lines \n to my mailing app through a mailto link.

Example :

  <a 
    target="mailto"
    rel="noopener noreferrer"
    href="mailto:adrien.amoros%40gmail.com?body="Hello%0AContent%0ARegards"
  >
    Send email
  </a>

When I click on that link on my phone, my Gmail app displays Hello Content Regards with spaces instead of break lines.

It's not the case on my desktop.

How to Reproduce

  1. Create an html page containing the previous example. The objective is to have encoded \n in the body of the email.
  2. Open that link on an android phone which uses a Gmail app as main client. => That's it

Phone: android Gmail app version: 2019.11.21.283644823.release

Luwangel avatar Jan 21 '20 17:01 Luwangel

Just want to clarify - If adding a line break in a mailto link you can specify %0D%0A - then a new line will start. Just to clarify you want it to look like this? e.g.

Hello Content Regards

JayOram avatar Jan 21 '20 17:01 JayOram

Hello,

The following example (using \r\n) is also broken.

  <a 
  target="mailto"
  rel="noopener noreferrer"
  href="mailto:adrien.amoros%40gmail.com?subject=test&body=Hello%0D%0AContent%0D%0ARegards"

>
  Send email
</a>

And yes I want it to look like this :)

e.g.

Hello Content Regards

Luwangel avatar Jan 21 '20 17:01 Luwangel

Is that still a problem with gmail mobile?

FelixSchwarz avatar Mar 24 '21 14:03 FelixSchwarz

I don't know, I have to test it again.

Luwangel avatar Mar 25 '21 08:03 Luwangel

this is still a problem : |

amyjchen avatar Dec 23 '21 05:12 amyjchen

Not justifying the bug, but it's worth pointing out that email clients need to sanitize mailto links which is probably why this bug exists. The mailto URI scheme allows a lot of parameters, some of which can be maliciously used. See: https://www.zdnet.com/article/some-email-clients-are-vulnerable-to-attacks-via-mailto-links/

husseinalhammad avatar Dec 23 '21 06:12 husseinalhammad