question-mark
Stuck on an issue?

Lightrun Answers was designed to reduce the constant googling that comes with debugging 3rd party libraries. It collects links to all the places you might be looking at while hunting down a tough bug.

And, if you’re still stuck at the end, we’re happy to hop on a call to see how we can help out.

MailComposer cannot send HTML emails and never resolves promise.

See original GitHub issue

Summary

Using MailComposer.composeAsync({ subject: ‘Subject’, isHtml: true, body: msg }) does not work on Android. The HTML is discarded, and only the text survives to the android mail composer.

After the mail is sent - the promise returned from mail compuser is never resolved. Neither then or catch. Also tried with await. Tried on HUAWAI with Android 10 & on Android Emluator Pixie XL with Android 11.

MailComposer works fine on iOS and were perfectly cabable of sending html emails.

"expo-mail-composer": "~11.1.0",

Managed or bare workflow? If you have ios/ or android/ directories in your project, the answer is bare!

managed

What platform(s) does this occur on?

Android

SDK Version (managed workflow only)

44.0.6

Environment

expo-env-info 1.0.2 environment info: System: OS: Windows 10 10.0.19043 Binaries: Node: 16.4.2 - C:\Program Files\nodejs\node.EXE Yarn: 1.22.11 - ~\AppData\Roaming\npm\yarn.CMD npm: 7.18.1 - C:\Program Files\nodejs\npm.CMD npmPackages: @expo/metro-config: ^0.3.8 => 0.3.12 babel-preset-expo: 9.0.2 => 9.0.2 expo: ^44.0.0 => 44.0.6 react: 17.0.1 => 17.0.1 react-dom: 17.0.1 => 17.0.1 react-native: 0.64.3 => 0.64.3 react-native-web: 0.17.1 => 0.17.1 react-navigation: ^4.4.4 => 4.4.4 Expo Workflow: managed

Dependencies:

“dependencies”: { “@aws-amplify/api”: “^4.0.34”, “@aws-amplify/datastore”: “^3.7.8”, “@aws-amplify/pubsub”: “^4.2.10”, “@aws-sdk/client-pinpoint”: “^3.54.1”, “@expo/metro-config”: “^0.3.8”, “@expo/vector-icons”: “^12.0.0”, “@react-native-async-storage/async-storage”: “~1.15.0”, “@react-native-community/masked-view”: “0.1.11”, “@react-native-community/netinfo”: “7.1.3”, “@react-native-community/rxjs”: “^6.5.4-custom”, “@react-native-community/slider”: “4.1.12”, “@react-navigation/drawer”: “^5.12.5”, “@react-navigation/material-bottom-tabs”: “^5.3.15”, “@react-navigation/native”: “^5.9.4”, “@react-navigation/stack”: “^5.14.5”, “@unimodules/core”: “~7.2.0”, “aws-amplify”: “^4.3.16”, “aws-amplify-react-native”: “^6.0.3”, “expo”: “^44.0.0”, “expo-app-loading”: “~1.3.0”, “expo-application”: “~4.0.1”, “expo-asset”: “~8.4.6”, “expo-av”: “~10.2.0”, “expo-camera”: “~12.1.2”, “expo-constants”: “~13.0.1”, “expo-contacts”: “~10.1.0”, “expo-device”: “~4.1.0”, “expo-face-detector”: “~11.1.3”, “expo-font”: “~10.0.4”, “expo-image-manipulator”: “~10.2.0”, “expo-keep-awake”: “~10.0.1”, “expo-linking”: “~3.0.0”, “expo-notifications”: “~0.14.0”, “expo-permissions”: “~13.1.0”, “expo-screen-orientation”: “~4.1.1”, “expo-splash-screen”: “~0.14.1”, “expo-updates”: “~0.11.6”, “expo-video-player”: “^1.5.8”, “expo-video-thumbnails”: “~6.1.0”, “expo-web-browser”: “~10.1.0”, “graphql”: “^14.0.0”, “inquirer”: “^7.2.0”, “libphonenumber-js”: “^1.9.44”, “lottie-react-native”: “5.0.1”, “moment”: “^2.29.1”, “react”: “17.0.1”, “react-dom”: “17.0.1”, “react-native”: “0.64.3”, “react-native-aws3”: “^0.0.9”, “react-native-fs”: “^2.17.0”, “react-native-gesture-handler”: “~2.1.0”, “react-native-keyboard-aware-scroll-view”: “^0.9.3”, “react-native-pager-view”: “5.4.9”, “react-native-paper”: “^4.11.2”, “react-native-reanimated”: “~2.3.1”, “react-native-safe-area-context”: “3.3.2”, “react-native-screens”: “~3.10.1”, “react-native-svg”: “12.1.1”, “react-native-svg-transformer”: “^0.14.3”, “react-native-tab-view”: “^3.0.1”, “react-native-uuid”: “^2.0.1”, “react-native-web”: “0.17.1”, “react-native-windows”: “0.64.5”, “react-navigation”: “^4.4.4”, “rxjs”: “^6.6.7”, “sentry-expo”: “^4.0.0”, “expo-mail-composer”: “~11.1.0”, “expo-file-system”: “~13.1.4” }, “devDependencies”: { “@babel/core”: “^7.12.9”, “@react-native-picker/picker”: “2.2.1”, “@types/react”: “~17.0.21”, “@types/react-native”: “~0.64.12”, “@types/react-native-uuid”: “^2.0.0”, “babel-preset-expo”: “9.0.2”, “ini”: “^1.3.5”, “typescript”: “~4.3.5” },

Reproducible demo

msg = <!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.0 Transitional//EN" "http://www.w3.org/TR/xhtml1/DTD/xhtml1-transitional.dtd"> <html xmlns=“http://www.w3.org/1999/xhtml”> <head> <meta http-equiv=“Content-Type” content=“text/html; charset=UTF-8” /> <meta name=“viewport” content=“width=device-width, initial-scale=1.0”/> </head> <body style=“margin: 0; padding: 0;”> <table align=“center” border=“1” cellpadding=“0” cellspacing=“0” width=“600”> <tr> <td> Row 1 </td> </tr> <tr> <td> Row 2 </td> </tr> <tr> <td> Row 3 </td> </tr> </table> </body> </html>`

        console.log("Going!")
        MailComposer.composeAsync({
            subject: 'Subject',
            isHtml: true,
            body: msg
        }).then((value => {
            console.log("Success!", value) //Never called
        })).catch(() => {
            console.log("ERR!") //Never called
        })

`

Issue Analytics

  • State:closed
  • Created 2 years ago
  • Reactions:1
  • Comments:5 (2 by maintainers)

github_iconTop GitHub Comments

1reaction
megantaylorcommented, Oct 31, 2022

I am also seeing the issue where MailComposer doesn’t return anything on android. please let me know if more information is required to try to fix this.

0reactions
github-actions[bot]commented, Sep 18, 2022

This issue was closed because it has been inactive for 7 days since being marked as stale. Please open a new issue if you believe you are encountering a related problem.

Read more comments on GitHub >

github_iconTop Results From Across the Web

Sending HTML emails from Node.JS using MailGun
You can use mailgun-js together with mailcomposer to send HTML formatted emails. The mailgun-js docs include an example:
Read more >
MailComposer - Expo Documentation
expo-mail-composer allows you to compose and send emails quickly and easily ... A promise resolves to true if the API can be used,...
Read more >
Mailcomposer - Nodemailer
Nodemailer is a module for Node.js to send emails.
Read more >
Change the message format to HTML, Rich Text Format, or ...
Switch the format of email messages, which controls formatting options that are available such as colors, fonts, and tables.
Read more >
User Manual — Mailgun API documentation
Sending a message with HTML and text parts. ... Pass yes , no or htmlonly . ... If you send an AMP email...
Read more >

github_iconTop Related Medium Post

No results found

github_iconTop Related StackOverflow Question

No results found

github_iconTroubleshoot Live Code

Lightrun enables developers to add logs, metrics and snapshots to live code - no restarts or redeploys required.
Start Free

github_iconTop Related Reddit Thread

No results found

github_iconTop Related Hackernoon Post

No results found

github_iconTop Related Tweet

No results found

github_iconTop Related Dev.to Post

No results found

github_iconTop Related Hashnode Post

No results found