How to use react-native-smtp-mailer - 1 common examples

To help you get started, we’ve selected a few react-native-smtp-mailer examples, based on popular ways it is used in public projects.

Secure your code as it's written. Use Snyk Code to scan source code in minutes - no build needed - and fix issues immediately.

github angelos3lex / react-native-smtp-mailer / example / App.js View on Github external
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 =&gt; alert(success))
      .catch(err =&gt; alert(err));
  };

react-native-smtp-mailer

Send emails by connecting to smtp server+attachments, using android javamail and ios mailcore2

MIT
Latest version published 3 years ago

Package Health Score

42 / 100
Full package analysis

Popular react-native-smtp-mailer functions