{"action":"created","comment":{"url":"https://api.github.com/repos/chirag04/react-native-mail/pulls/comments/38827047","id":38827047,"diff_hunk":"@@ -47,6 +47,39 @@ - (dispatch_queue_t)methodQueue\n             [mail setToRecipients:recipients];\n         }\n         \n+        if (options[@\"attachmentPath\"] && options[@\"attachmentType\"]){\n+            NSString *attachmentPath = [RCTConvert NSString:options[@\"attachmentPath\"]];\n+            NSString *attachmentType = [RCTConvert NSString:options[@\"attachmentType\"]];\n+            NSString *attachmentName = [RCTConvert NSString:options[@\"attachmentName\"]];\n+            \n+            // Set default filename if not specificed\n+            if (!attachmentName) {\n+                attachmentName = [[attachmentPath lastPathComponent] stringByDeletingPathExtension];\n+            }\n+            \n+            // Get the resource path and read the file using NSData\n+            NSData *fileData = [NSData dataWithContentsOfFile:attachmentPath];\n+            \n+            // Determine the MIME type\n+            NSString *mimeType;\n+            if ([attachmentType isEqualToString:@\"jpg\"]) {","path":"RNMail/RNMail.m","position":19,"original_position":19,"commit_id":"47ea00b50f99d942c3604c6e73f7f4c2d50fab74","original_commit_id":"47ea00b50f99d942c3604c6e73f7f4c2d50fab74","user":{"login":"chirag04","id":954063,"avatar_url":"https://avatars.githubusercontent.com/u/954063?v=3","gravatar_id":"","url":"https://api.github.com/users/chirag04","html_url":"https://github.com/chirag04","followers_url":"https://api.github.com/users/chirag04/followers","following_url":"https://api.github.com/users/chirag04/following{/other_user}","gists_url":"https://api.github.com/users/chirag04/gists{/gist_id}","starred_url":"https://api.github.com/users/chirag04/starred{/owner}{/repo}","subscriptions_url":"https://api.github.com/users/chirag04/subscriptions","organizations_url":"https://api.github.com/users/chirag04/orgs","repos_url":"https://api.github.com/users/chirag04/repos","events_url":"https://api.github.com/users/chirag04/events{/privacy}","received_events_url":"https://api.github.com/users/chirag04/received_events","type":"User","site_admin":false},"body":"would a switch case be easy to maintain?","created_at":"2015-09-06T22:40:19Z","updated_at":"2015-09-06T22:40:19Z","html_url":"https://github.com/chirag04/react-native-mail/pull/3#discussion_r38827047","pull_request_url":"https://api.github.com/repos/chirag04/react-native-mail/pulls/3","_links":{"self":{"href":"https://api.github.com/repos/chirag04/react-native-mail/pulls/comments/38827047"},"html":{"href":"https://github.com/chirag04/react-native-mail/pull/3#discussion_r38827047"},"pull_request":{"href":"https://api.github.com/repos/chirag04/react-native-mail/pulls/3"}}},"pull_request":{"url":"https://api.github.com/repos/chirag04/react-native-mail/pulls/3","id":44145649,"html_url":"https://github.com/chirag04/react-native-mail/pull/3","diff_url":"https://github.com/chirag04/react-native-mail/pull/3.diff","patch_url":"https://github.com/chirag04/react-native-mail/pull/3.patch","issue_url":"https://api.github.com/repos/chirag04/react-native-mail/issues/3","number":3,"state":"open","locked":false,"title":"Add support for attachments","user":{"login":"christopherdro","id":3741055,"avatar_url":"https://avatars.githubusercontent.com/u/3741055?v=3","gravatar_id":"","url":"https://api.github.com/users/christopherdro","html_url":"https://github.com/christopherdro","followers_url":"https://api.github.com/users/christopherdro/followers","following_url":"https://api.github.com/users/christopherdro/following{/other_user}","gists_url":"https://api.github.com/users/christopherdro/gists{/gist_id}","starred_url":"https://api.github.com/users/christopherdro/starred{/owner}{/repo}","subscriptions_url":"https://api.github.com/users/christopherdro/subscriptions","organizations_url":"https://api.github.com/users/christopherdro/orgs","repos_url":"https://api.github.com/users/christopherdro/repos","events_url":"https://api.github.com/users/christopherdro/events{/privacy}","received_events_url":"https://api.github.com/users/christopherdro/received_events","type":"User","site_admin":false},"body":"","created_at":"2015-09-03T19:14:48Z","updated_at":"2015-09-06T22:40:19Z","closed_at":null,"merged_at":null,"merge_commit_sha":"0094f41b7db8211aaa8eccd97f5ec180c404d2d2","assignee":null,"milestone":null,"commits_url":"https://api.github.com/repos/chirag04/react-native-mail/pulls/3/commits","review_comments_url":"https://api.github.com/repos/chirag04/react-native-mail/pulls/3/comments","review_comment_url":"https://api.github.com/repos/chirag04/react-native-mail/pulls/comments{/number}","comments_url":"https://api.github.com/repos/chirag04/react-native-mail/issues/3/comments","statuses_url":"https://api.github.com/repos/chirag04/react-native-mail/statuses/47ea00b50f99d942c3604c6e73f7f4c2d50fab74","head":{"label":"christopherdro:attachments","ref":"attachments","sha":"47ea00b50f99d942c3604c6e73f7f4c2d50fab74","user":{"login":"christopherdro","id":3741055,"avatar_url":"https://avatars.githubusercontent.com/u/3741055?v=3","gravatar_id":"","url":"https://api.github.com/users/christopherdro","html_url":"https://github.com/christopherdro","followers_url":"https://api.github.com/users/christopherdro/followers","following_url":"https://api.github.com/users/christopherdro/following{/other_user}","gists_url":"https://api.github.com/users/christopherdro/gists{/gist_id}","starred_url":"https://api.github.com/users/christopherdro/starred{/owner}{/repo}","subscriptions_url":"https://api.github.com/users/christopherdro/subscriptions","organizations_url":"https://api.github.com/users/christopherdro/orgs","repos_url":"https://api.github.com/users/christopherdro/repos","events_url":"https://api.github.com/users/christopherdro/events{/privacy}","received_events_url":"https://api.github.com/users/christopherdro/received_events","type":"User","site_admin":false},"repo":{"id":41877828,"name":"react-native-mail","full_name":"christopherdro/react-native-mail","owner":{"login":"christopherdro","id":3741055,"avatar_url":"https://avatars.githubusercontent.com/u/3741055?v=3","gravatar_id":"","url":"https://api.github.com/users/christopherdro","html_url":"https://github.com/christopherdro","followers_url":"https://api.github.com/users/christopherdro/followers","following_url":"https://api.github.com/users/christopherdro/following{/other_user}","gists_url":"https://api.github.com/users/christopherdro/gists{/gist_id}","starred_url":"https://api.github.com/users/christopherdro/starred{/owner}{/repo}","subscriptions_url":"https://api.github.com/users/christopherdro/subscriptions","organizations_url":"https://api.github.com/users/christopherdro/orgs","repos_url":"https://api.github.com/users/christopherdro/repos","events_url":"https://api.github.com/users/christopherdro/events{/privacy}","received_events_url":"https://api.github.com/users/christopherdro/received_events","type":"User","site_admin":false},"private":false,"html_url":"https://github.com/christopherdro/react-native-mail","description":"Send emails with attachments using React Native","fork":true,"url":"https://api.github.com/repos/christopherdro/react-native-mail","forks_url":"https://api.github.com/repos/christopherdro/react-native-mail/forks","keys_url":"https://api.github.com/repos/christopherdro/react-native-mail/keys{/key_id}","collaborators_url":"https://api.github.com/repos/christopherdro/react-native-mail/collaborators{/collaborator}","teams_url":"https://api.github.com/repos/christopherdro/react-native-mail/teams","hooks_url":"https://api.github.com/repos/christopherdro/react-native-mail/hooks","issue_events_url":"https://api.github.com/repos/christopherdro/react-native-mail/issues/events{/number}","events_url":"https://api.github.com/repos/christopherdro/react-native-mail/events","assignees_url":"https://api.github.com/repos/christopherdro/react-native-mail/assignees{/user}","branches_url":"https://api.github.com/repos/christopherdro/react-native-mail/branches{/branch}","tags_url":"https://api.github.com/repos/christopherdro/react-native-mail/tags","blobs_url":"https://api.github.com/repos/christopherdro/react-native-mail/git/blobs{/sha}","git_tags_url":"https://api.github.com/repos/christopherdro/react-native-mail/git/tags{/sha}","git_refs_url":"https://api.github.com/repos/christopherdro/react-native-mail/git/refs{/sha}","trees_url":"https://api.github.com/repos/christopherdro/react-native-mail/git/trees{/sha}","statuses_url":"https://api.github.com/repos/christopherdro/react-native-mail/statuses/{sha}","languages_url":"https://api.github.com/repos/christopherdro/react-native-mail/languages","stargazers_url":"https://api.github.com/repos/christopherdro/react-native-mail/stargazers","contributors_url":"https://api.github.com/repos/christopherdro/react-native-mail/contributors","subscribers_url":"https://api.github.com/repos/christopherdro/react-native-mail/subscribers","subscription_url":"https://api.github.com/repos/christopherdro/react-native-mail/subscription","commits_url":"https://api.github.com/repos/christopherdro/react-native-mail/commits{/sha}","git_commits_url":"https://api.github.com/repos/christopherdro/react-native-mail/git/commits{/sha}","comments_url":"https://api.github.com/repos/christopherdro/react-native-mail/comments{/number}","issue_comment_url":"https://api.github.com/repos/christopherdro/react-native-mail/issues/comments{/number}","contents_url":"https://api.github.com/repos/christopherdro/react-native-mail/contents/{+path}","compare_url":"https://api.github.com/repos/christopherdro/react-native-mail/compare/{base}...{head}","merges_url":"https://api.github.com/repos/christopherdro/react-native-mail/merges","archive_url":"https://api.github.com/repos/christopherdro/react-native-mail/{archive_format}{/ref}","downloads_url":"https://api.github.com/repos/christopherdro/react-native-mail/downloads","issues_url":"https://api.github.com/repos/christopherdro/react-native-mail/issues{/number}","pulls_url":"https://api.github.com/repos/christopherdro/react-native-mail/pulls{/number}","milestones_url":"https://api.github.com/repos/christopherdro/react-native-mail/milestones{/number}","notifications_url":"https://api.github.com/repos/christopherdro/react-native-mail/notifications{?since,all,participating}","labels_url":"https://api.github.com/repos/christopherdro/react-native-mail/labels{/name}","releases_url":"https://api.github.com/repos/christopherdro/react-native-mail/releases{/id}","created_at":"2015-09-03T18:53:15Z","updated_at":"2015-09-03T19:07:46Z","pushed_at":"2015-09-03T19:14:15Z","git_url":"git://github.com/christopherdro/react-native-mail.git","ssh_url":"git@github.com:christopherdro/react-native-mail.git","clone_url":"https://github.com/christopherdro/react-native-mail.git","svn_url":"https://github.com/christopherdro/react-native-mail","homepage":"","size":107,"stargazers_count":0,"watchers_count":0,"language":"Objective-C","has_issues":false,"has_downloads":true,"has_wiki":true,"has_pages":false,"forks_count":0,"mirror_url":null,"open_issues_count":0,"forks":0,"open_issues":0,"watchers":0,"default_branch":"master"}},"base":{"label":"chirag04:master","ref":"master","sha":"ba5b62020919de4a5ccd4795362ae3252bd1eabf","user":{"login":"chirag04","id":954063,"avatar_url":"https://avatars.githubusercontent.com/u/954063?v=3","gravatar_id":"","url":"https://api.github.com/users/chirag04","html_url":"https://github.com/chirag04","followers_url":"https://api.github.com/users/chirag04/followers","following_url":"https://api.github.com/users/chirag04/following{/other_user}","gists_url":"https://api.github.com/users/chirag04/gists{/gist_id}","starred_url":"https://api.github.com/users/chirag04/starred{/owner}{/repo}","subscriptions_url":"https://api.github.com/users/chirag04/subscriptions","organizations_url":"https://api.github.com/users/chirag04/orgs","repos_url":"https://api.github.com/users/chirag04/repos","events_url":"https://api.github.com/users/chirag04/events{/privacy}","received_events_url":"https://api.github.com/users/chirag04/received_events","type":"User","site_admin":false},"repo":{"id":35357597,"name":"react-native-mail","full_name":"chirag04/react-native-mail","owner":{"login":"chirag04","id":954063,"avatar_url":"https://avatars.githubusercontent.com/u/954063?v=3","gravatar_id":"","url":"https://api.github.com/users/chirag04","html_url":"https://github.com/chirag04","followers_url":"https://api.github.com/users/chirag04/followers","following_url":"https://api.github.com/users/chirag04/following{/other_user}","gists_url":"https://api.github.com/users/chirag04/gists{/gist_id}","starred_url":"https://api.github.com/users/chirag04/starred{/owner}{/repo}","subscriptions_url":"https://api.github.com/users/chirag04/subscriptions","organizations_url":"https://api.github.com/users/chirag04/orgs","repos_url":"https://api.github.com/users/chirag04/repos","events_url":"https://api.github.com/users/chirag04/events{/privacy}","received_events_url":"https://api.github.com/users/chirag04/received_events","type":"User","site_admin":false},"private":false,"html_url":"https://github.com/chirag04/react-native-mail","description":"A wrapper on top of MFMailComposeViewController","fork":false,"url":"https://api.github.com/repos/chirag04/react-native-mail","forks_url":"https://api.github.com/repos/chirag04/react-native-mail/forks","keys_url":"https://api.github.com/repos/chirag04/react-native-mail/keys{/key_id}","collaborators_url":"https://api.github.com/repos/chirag04/react-native-mail/collaborators{/collaborator}","teams_url":"https://api.github.com/repos/chirag04/react-native-mail/teams","hooks_url":"https://api.github.com/repos/chirag04/react-native-mail/hooks","issue_events_url":"https://api.github.com/repos/chirag04/react-native-mail/issues/events{/number}","events_url":"https://api.github.com/repos/chirag04/react-native-mail/events","assignees_url":"https://api.github.com/repos/chirag04/react-native-mail/assignees{/user}","branches_url":"https://api.github.com/repos/chirag04/react-native-mail/branches{/branch}","tags_url":"https://api.github.com/repos/chirag04/react-native-mail/tags","blobs_url":"https://api.github.com/repos/chirag04/react-native-mail/git/blobs{/sha}","git_tags_url":"https://api.github.com/repos/chirag04/react-native-mail/git/tags{/sha}","git_refs_url":"https://api.github.com/repos/chirag04/react-native-mail/git/refs{/sha}","trees_url":"https://api.github.com/repos/chirag04/react-native-mail/git/trees{/sha}","statuses_url":"https://api.github.com/repos/chirag04/react-native-mail/statuses/{sha}","languages_url":"https://api.github.com/repos/chirag04/react-native-mail/languages","stargazers_url":"https://api.github.com/repos/chirag04/react-native-mail/stargazers","contributors_url":"https://api.github.com/repos/chirag04/react-native-mail/contributors","subscribers_url":"https://api.github.com/repos/chirag04/react-native-mail/subscribers","subscription_url":"https://api.github.com/repos/chirag04/react-native-mail/subscription","commits_url":"https://api.github.com/repos/chirag04/react-native-mail/commits{/sha}","git_commits_url":"https://api.github.com/repos/chirag04/react-native-mail/git/commits{/sha}","comments_url":"https://api.github.com/repos/chirag04/react-native-mail/comments{/number}","issue_comment_url":"https://api.github.com/repos/chirag04/react-native-mail/issues/comments{/number}","contents_url":"https://api.github.com/repos/chirag04/react-native-mail/contents/{+path}","compare_url":"https://api.github.com/repos/chirag04/react-native-mail/compare/{base}...{head}","merges_url":"https://api.github.com/repos/chirag04/react-native-mail/merges","archive_url":"https://api.github.com/repos/chirag04/react-native-mail/{archive_format}{/ref}","downloads_url":"https://api.github.com/repos/chirag04/react-native-mail/downloads","issues_url":"https://api.github.com/repos/chirag04/react-native-mail/issues{/number}","pulls_url":"https://api.github.com/repos/chirag04/react-native-mail/pulls{/number}","milestones_url":"https://api.github.com/repos/chirag04/react-native-mail/milestones{/number}","notifications_url":"https://api.github.com/repos/chirag04/react-native-mail/notifications{?since,all,participating}","labels_url":"https://api.github.com/repos/chirag04/react-native-mail/labels{/name}","releases_url":"https://api.github.com/repos/chirag04/react-native-mail/releases{/id}","created_at":"2015-05-10T04:53:50Z","updated_at":"2015-09-03T20:05:08Z","pushed_at":"2015-09-03T19:14:48Z","git_url":"git://github.com/chirag04/react-native-mail.git","ssh_url":"git@github.com:chirag04/react-native-mail.git","clone_url":"https://github.com/chirag04/react-native-mail.git","svn_url":"https://github.com/chirag04/react-native-mail","homepage":null,"size":197,"stargazers_count":20,"watchers_count":20,"language":"Objective-C","has_issues":true,"has_downloads":true,"has_wiki":true,"has_pages":false,"forks_count":4,"mirror_url":null,"open_issues_count":3,"forks":4,"open_issues":3,"watchers":20,"default_branch":"master"}},"_links":{"self":{"href":"https://api.github.com/repos/chirag04/react-native-mail/pulls/3"},"html":{"href":"https://github.com/chirag04/react-native-mail/pull/3"},"issue":{"href":"https://api.github.com/repos/chirag04/react-native-mail/issues/3"},"comments":{"href":"https://api.github.com/repos/chirag04/react-native-mail/issues/3/comments"},"review_comments":{"href":"https://api.github.com/repos/chirag04/react-native-mail/pulls/3/comments"},"review_comment":{"href":"https://api.github.com/repos/chirag04/react-native-mail/pulls/comments{/number}"},"commits":{"href":"https://api.github.com/repos/chirag04/react-native-mail/pulls/3/commits"},"statuses":{"href":"https://api.github.com/repos/chirag04/react-native-mail/statuses/47ea00b50f99d942c3604c6e73f7f4c2d50fab74"}}}}