javascript - React Native - 使用正文打开邮件客户端
问题描述
我正在使用 npm pacakge 打开带有数据的邮件客户端: https ://www.npmjs.com/package/react-native-mail-compose
另外,我正在使用他们的示例:
import MailCompose from 'react-native-mail-compose';
// later in your code...
async sendMail() {
try {
await MailCompose.send({
toRecipients: ['to1@example.com', 'to2@example.com'],
ccRecipients: ['cc1@example.com'],
bccRecipients: ['bcc1@example.com', 'bcc2@example.com'],
subject: 'This is subject',
text: 'This is body',
html: '<p>This is <b>html</b> body</p>', // Or, use this if you want html body. Note that some Android mail clients / devices don't support this properly.
attachments: [{
filename: 'mytext', // [Optional] If not provided, UUID will be generated.
ext: '.txt',
mimeType: 'text/plain',
text: 'Hello my friend', // Use this if the data is in UTF8 text.
data: '...BASE64_ENCODED_STRING...', // Or, use this if the data is not in plain text.
}],
});
} catch (e) {
// e.code may be 'cannotSendMail' || 'cancelled' || 'saved' || 'failed'
}
}
并在按钮按下时调用此函数。所有数据都可以,除了正文,例如在主题中有“这是主题”,在邮件客户端的抄送中,有“cc1@example.com”,但正文总是空的,我看不到“这是邮件客户端中的正文”。
解决方案
我已经用另一个包react-native-send-intent修复了它。它就像一个魅力!:)
推荐阅读
- react-native - 无法使用 PushNotificationIOS(react-native-ios)在任何应用程序状态下接收通知
- utf-8 - 在 Dropwizard 中处理来自码头的 Servet 异常
- github - 当我在我的分支上工作时,我的推送没有显示在 GitHub 上
- jquery - 仅在动画后开始滚动
- python - 由于某种原因,Docker python 图像真的很大
- python - python上的一列到两列列表
- python - Python null(未定义)检查最佳方法
- opencv - 来自 EstimatePoseSingleMarkers 的变换矩阵
- sql - 挣扎于子查询和连接
- python - 使用切片列表对多维数组进行索引切片