react-native-mail-attachment
v0.0.12
Published
send email with attachment
Downloads
11
Readme
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 = '[email protected]';
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 = '[email protected]';
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