{"id":13776917,"url":"https://github.com/chirag04/react-native-mail","last_synced_at":"2025-05-15T07:04:54.301Z","repository":{"id":31791138,"uuid":"35357597","full_name":"chirag04/react-native-mail","owner":"chirag04","description":"A wrapper on top of MFMailComposeViewController from iOS and Mail Intent on android","archived":false,"fork":false,"pushed_at":"2024-07-25T12:32:41.000Z","size":319,"stargazers_count":445,"open_issues_count":84,"forks_count":249,"subscribers_count":12,"default_branch":"master","last_synced_at":"2025-04-11T15:57:13.245Z","etag":null,"topics":[],"latest_commit_sha":null,"homepage":"","language":"Objective-C","has_issues":true,"has_wiki":null,"has_pages":null,"mirror_url":null,"source_name":null,"license":"mit","status":null,"scm":"git","pull_requests_enabled":true,"icon_url":"https://github.com/chirag04.png","metadata":{"files":{"readme":"README.md","changelog":null,"contributing":null,"funding":null,"license":"LICENSE","code_of_conduct":null,"threat_model":null,"audit":null,"citation":null,"codeowners":null,"security":null,"support":null,"governance":null,"roadmap":null,"authors":null,"dei":null,"publiccode":null,"codemeta":null}},"created_at":"2015-05-10T04:53:50.000Z","updated_at":"2024-09-13T06:07:16.000Z","dependencies_parsed_at":"2024-02-12T17:02:42.555Z","dependency_job_id":"cd936eb7-ff28-4f37-905e-546d3206a3cb","html_url":"https://github.com/chirag04/react-native-mail","commit_stats":{"total_commits":125,"total_committers":50,"mean_commits":2.5,"dds":0.656,"last_synced_commit":"340618e4ef7f21a29d739d4180c2a267a14093d3"},"previous_names":[],"tags_count":28,"template":false,"template_full_name":null,"repository_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/chirag04%2Freact-native-mail","tags_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/chirag04%2Freact-native-mail/tags","releases_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/chirag04%2Freact-native-mail/releases","manifests_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/chirag04%2Freact-native-mail/manifests","owner_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/owners/chirag04","download_url":"https://codeload.github.com/chirag04/react-native-mail/tar.gz/refs/heads/master","host":{"name":"GitHub","url":"https://github.com","kind":"github","repositories_count":254292039,"owners_count":22046426,"icon_url":"https://github.com/github.png","version":null,"created_at":"2022-05-30T11:31:42.601Z","updated_at":"2022-07-04T15:15:14.044Z","host_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub","repositories_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories","repository_names_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repository_names","owners_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/owners"}},"keywords":[],"created_at":"2024-08-03T18:00:34.935Z","updated_at":"2025-05-15T07:04:49.292Z","avatar_url":"https://github.com/chirag04.png","language":"Objective-C","readme":"# react-native-mail\n\nA React Native wrapper for Apple's ``MFMailComposeViewController`` from iOS and Mail Intent on android\nSupports emails with attachments.\n\n## Installation\n\nThere was a breaking change in RN \u003e=40. So for React Native \u003e= 0.40: use v3.x and higher of this lib. otherwise use v2.x\n\n```bash\nnpm i --save react-native-mail # npm syntax\nyarn add react-native-mail # yarn syntax\n```\n\n### Automatic Installation\nYou can automatically link the native components or follow the manual instructions below if you prefer.\n\n ```bash\n react-native link\n ```\n\n### Manual Installation: Android\n\n* In `android/setting.gradle`\n\n```gradle\n...\ninclude ':RNMail', ':app'\nproject(':RNMail').projectDir = new File(rootProject.projectDir, '../node_modules/react-native-mail/android')\n```\n\n* In `android/app/build.gradle`\n\n```gradle\n...\ndependencies {\n    ...\n    compile project(':RNMail')\n}\n```\n\n* if MainActivity extends Activity: register module in MainActivity.java\n\n\n```java\nimport com.chirag.RNMail.*;  // \u003c--- import\n\npublic class MainActivity extends Activity implements DefaultHardwareBackBtnHandler {\n  ......\n\n  @Override\n  protected void onCreate(Bundle savedInstanceState) {\n    super.onCreate(savedInstanceState);\n    mReactRootView = new ReactRootView(this);\n\n    mReactInstanceManager = ReactInstanceManager.builder()\n      .setApplication(getApplication())\n      .setBundleAssetName(\"index.android.bundle\")\n      .setJSMainModuleName(\"index.android\")\n      .addPackage(new MainReactPackage())\n      .addPackage(new RNMail())              // \u003c------ add here\n      .setUseDeveloperSupport(BuildConfig.DEBUG)\n      .setInitialLifecycleState(LifecycleState.RESUMED)\n      .build();\n\n    mReactRootView.startReactApplication(mReactInstanceManager, \"ExampleRN\", null);\n\n    setContentView(mReactRootView);\n  }\n\n  ......\n\n}\n```\n* else if MainActivity extends ReactActivity: register module in `MainApplication.java`\n\n```java\nimport com.chirag.RNMail.*; // \u003c--- import\n\npublic class MainApplication extends Application implements ReactApplication {\n    ....\n\n    @Override\n    protected List\u003cReactPackage\u003e getPackages() {\n      return Arrays.\u003cReactPackage\u003easList(\n          new MainReactPackage(),\n          new RNMail()      // \u003c------ add here\n      );\n    }\n  };\n\n```\n\n\n\n### Manual Installation: iOS\n\n1. Run `npm install react-native-mail --save`\n2. Open your project in XCode, right click on `Libraries` and click `Add\n   Files to \"Your Project Name\"` [(Screenshot)](http://url.brentvatne.ca/jQp8) then navigate to node_modules/react-native-mail and select RNMail.xcodeproj [(Screenshot)](https://github.com/pedramsaleh/react-native-mail/blob/master/add-xcodeproj.png?raw=true).\n3. Add `libRNMail.a` to `Build Phases -\u003e Link Binary With Libraries`\n   [(Screenshot)](http://url.brentvatne.ca/17Xfe).\n4. Whenever you want to use it within React code now you can: `var Mailer = require('NativeModules').RNMail;`\n\n\n## Example\n```javascript\n/**\n * Sample React Native App\n * https://github.com/facebook/react-native\n * @flow\n */\n\nimport React, { Component } from 'react';\nimport { View, Alert, Button } from 'react-native';\nimport Mailer from 'react-native-mail';\n\nexport default class App extends Component {\n\n  handleEmail = () =\u003e {\n    Mailer.mail({\n      subject: 'need help',\n      recipients: ['support@example.com'],\n      ccRecipients: ['supportCC@example.com'],\n      bccRecipients: ['supportBCC@example.com'],\n      body: '\u003cb\u003eA Bold Body\u003c/b\u003e',\n      customChooserTitle: 'This is my new title', // Android only (defaults to \"Send Mail\")\n      isHTML: true,\n      attachments: [{\n        // Specify either `path` or `uri` to indicate where to find the file data.\n        // The API used to create or locate the file will usually indicate which it returns.\n        // An absolute path will look like: /cacheDir/photos/some image.jpg\n        // A URI starts with a protocol and looks like: content://appname/cacheDir/photos/some%20image.jpg\n        path: '', // The absolute path of the file from which to read data.\n        uri: '', // The uri of the file from which to read the data.\n        // Specify either `type` or `mimeType` to indicate the type of data.\n        type: '', // Mime Type: jpg, png, doc, ppt, html, pdf, csv\n        mimeType: '', // - use only if you want to use custom type\n        name: '', // Optional: Custom filename for attachment\n      }]\n    }, (error, event) =\u003e {\n      Alert.alert(\n        error,\n        event,\n        [\n          {text: 'Ok', onPress: () =\u003e console.log('OK: Email Error Response')},\n          {text: 'Cancel', onPress: () =\u003e console.log('CANCEL: Email Error Response')}\n        ],\n        { cancelable: true }\n      )\n    });\n  }\n\n  render() {\n    return (\n      \u003cView style={styles.container}\u003e\n        \u003cButton\n          onPress={this.handleEmail}\n          title=\"Email Me\"\n          color=\"#841584\"\n          accessabilityLabel=\"Purple Email Me Button\"\n        /\u003e\n      \u003c/View\u003e\n    );\n  }\n}\n\n\n```\n\n### Note\n\nOn Android, the `callback` will only be called if an `error` occurs. The `event` argument is unused!\n\n## Here is how it looks:\n![Demo gif](https://github.com/chirag04/react-native-mail/blob/master/screenshot.png)\n","funding_links":[],"categories":["\u003ca name=\"Network:-Native-Modules\"\u003eNetwork: Native Modules\u003c/a\u003e","Objective-C"],"sub_categories":[],"project_url":"https://awesome.ecosyste.ms/api/v1/projects/github.com%2Fchirag04%2Freact-native-mail","html_url":"https://awesome.ecosyste.ms/projects/github.com%2Fchirag04%2Freact-native-mail","lists_url":"https://awesome.ecosyste.ms/api/v1/projects/github.com%2Fchirag04%2Freact-native-mail/lists"}