Breaking News
Home / iOS / iOS Snippets / How to invoke Mail app in iOS for sending email?

How to invoke Mail app in iOS for sending email?

Answer

The email app can be invoked by getting a handle to the application using the UIApplication sharedApplication method and invoking the openURL method passing the url with the mailto syntax as show below.

Snippet

  1. (void) invokeEmailApp
  2. {
  3. // sample of email outlet
  4. NSString *url = [NSString stringWithString:@"mailto:foo@example.com?cc=bar@example.com&subject=Greetings%20from%20Cupertino!&body=Hello%20there!"];
  5.        
  6. [[UIApplication sharedApplication] openURL: [NSURL URLWithString: url]];
  7. }
[pb_builder]

Check Also

EKCalendar – That account does not allow calendars to be added or removed

Usecase When I am trying to create a new Calendar programmatically using the EventKit API …

Leave a Reply