ChangJoo Park
ChangJoo Park

Reputation: 979

React native linking mail api support subject, body?

Hello I use Linking api to open mailto.

I try to call mail app using below

Linking.openURL('mailto://[email protected]&subject=abcdefg&body=body')

but It will open maill app with to:[email protected]&subject=abcdefg&body=body

subject and body are empty

Upvotes: 32

Views: 29188

Answers (2)

chrisK
chrisK

Reputation: 148

Here are my cases:

  • SMS link:

return (Platform.OS === 'android') ? sms:1-408-555-1212?body=yourMessage : sms:1-408-555-1212&body=yourMessage;

  • Mail link:

return (Platform.OS === 'android') ? mailto:[email protected]?cc=?subject=yourSubject&body=yourMessage : mailto:[email protected]?cc=&subject=yourSubject&body=yourMessage;

Note: your mail url must contain cc= even if you don't have any cc emails.

  • iOS: you use ?
  • android: you use &

for the first parameter.

Upvotes: 4

G. Hamaide
G. Hamaide

Reputation: 7106

You need to remove the '//' in your url and add a '?' : mailto:[email protected]?subject=abcdefg&body=body

Upvotes: 60

Related Questions