我想在这里实现的是我已经实现了react-native-smtp-mailer,在其附件中,我如何做到这一点,以便从设备中选择文件并发送电子邮件。
RNSmtpMailer.sendMail({
mailhost: "smtp.gmail.com",
port: "465",
ssl: true,
username: "usernameEmail",
password: "password",
from: "fromEmail",
recipients: "toEmail1,toEmail2",
subject: "subject",
htmlBody: "<h1>header</h1><p>body</p>",
attachmentPaths: [
RNFS.ExternalDirectoryPath + "/image.jpg",
RNFS.DocumentDirectoryPath + "/test.txt",
RNFS.DocumentDirectoryPath + "/test2.csv",
RNFS.DocumentDirectoryPath + "/pdfFile.pdf",
RNFS.DocumentDirectoryPath + "/zipFile.zip",
RNFS.DocumentDirectoryPath + "/image.png"
],
attachmentNames: [
"image.jpg",
"firstFile.txt",
"secondFile.csv",
"pdfFile.pdf",
"zipExample.zip",
"pngImage.png"
]
attachmentTypes: ["img", "txt", "csv", "pdf", "zip", "img"]
})
.then(success => console.log(success))
.catch(err => console.log(err));
我不知道如何选择文件。