Secure your code as it's written. Use Snyk Code to scan source code in minutes - no build needed - and fix issues immediately.
sendEmail = () => {
RNSmtpMailer.sendMail({
mailhost: "smtp.gmail.com",
port: "465",
ssl: true, //if ssl: false, TLS is enabled,**note:** in iOS TLS/SSL is determined automatically, so either true or false is the same
username: "username",
password: "password",
from: "fromEmail",
recipients: "toEmail1,toEmail2",
subject: "subject",
htmlBody: "<h1>header</h1><p>body</p>",
attachmentPaths: ["pathToFile1.png","pathToFile2.txt","pathToFile3.csv"],
attachmentNames: ["image.jpg", "firstFile.txt", "secondFile.csv"],//only used in android, these are renames of original files. in ios filenames will be same as specified in path. In ios-only application, leave it empty: attachmentNames:[]
attachmentTypes: ["img", "txt", "csv"]//needed for android, in ios-only application, leave it empty: attachmentTypes:[]
})
.then(success => alert(success))
.catch(err => alert(err));
};