react-native-mail-attachment
TypeScript icon, indicating that this package has built-in type declarations

0.0.12 • Public • Published

react-native-mail-attachment

Send email with attachment

Installation

react-native > 0.72.0 (currently)

npm install react-native-mail-attachment
yarn add react-native-mail-attachment
cd ios && pod install

Usage

//CLASS 
import MailAttachment from 'react-native-mail-attachment';

const App = () => {
  const recipient = 'recipient@example.com';
  const subject = 'Subject';
  const body = 'Email body';
  const attachmentUri = '/path/to/attachment/file';

  return (
    <>
      <View style={{height: 70}} />
      <TouchableOpacity onPress={
        async () => { 
         MailAttachment.sendEmailWithAttachment(attachmentUri,recipient,subject, body)}}>
        <Text> Send email</Text>
      </TouchableOpacity>
    </>
  );
};


//FUNCTION 
import { sendEmailWithAttachment} from 'react-native-mail-attachment';

const App = () => {
  const recipient = 'recipient@example.com';
  const subject = 'Subject';
  const body = 'Email body';
  const attachmentUri = '/path/to/attachment/file';

  return (
    <>
      <View style={{height: 70}} />
      <TouchableOpacity onPress={
        async () => { 
      sendEmailWithAttachment(attachmentUri,recipient,subject, body)}}>
        <Text> Send email</Text>
      </TouchableOpacity>
    </>
  );
};

// ...

Current API(Property)

Property Type Description
sendEmailWithAttachment void android & ios
pickFile function android
recipient string (optional) render component
subject string (optional) email subject
body string (optional) email body
URI string (required) PDF or TXT or jpg

Contributing

See the contributing guide to learn how to contribute to the repository and the development workflow.

License

MIT


Package Sidebar

Install

npm i react-native-mail-attachment

Weekly Downloads

18

Version

0.0.12

License

MIT

Unpacked Size

63.3 kB

Total Files

36

Last publish

Collaborators

  • arwysyah