Search code examples
javascriptandroidmailto

Android mailto with attachment not working using javascript


Using javascript to open email. Email client comes up but no attachment. Can anyone tell me why this isn't working? I have tried multiple ways, /sdcard, /test.png, with "", without "". I have access to External Storage.

window.open('mailto:?subject=' + subject + '&body=This is the body text&attachment="/mnt/sdcard/Test.png"');

Here is my console.log

I/ActivityManager(  152): Displayed android/com.android.internal.app.ResolverActivity: +361ms

I/ActivityManager(  152): Starting: Intent { act=android.intent.action.VIEW dat=mailto:?subject=Test&body=This%20is%20the%20body%20text&attachment=%22/mnt/sdcard/Test.png%22 flg=0x3800000 cmp=com.google.android.email/com.android.email.activity.MessageCompose } from pid 152

Solution

  • You can't specify an attachment using a mailto link. That doesn't work in ANY browser.