Skip to content

Instantly share code, notes, and snippets.

@bad-mushroom
Created November 14, 2014 02:19
Show Gist options
  • Save bad-mushroom/3bcbc9f0410becbcba7e to your computer and use it in GitHub Desktop.
Save bad-mushroom/3bcbc9f0410becbcba7e to your computer and use it in GitHub Desktop.
Send email
-(void)sendEmailTo:(NSString *)to withSubject:(NSString *)subject withBody:(NSString *)body
{
NSString *mailString = [NSString stringWithFormat:@"mailto:?to=%@&subject=%@&body=%@",
[to stringByAddingPercentEscapesUsingEncoding:NSASCIIStringEncoding],
[subject stringByAddingPercentEscapesUsingEncoding:NSASCIIStringEncoding],
[body stringByAddingPercentEscapesUsingEncoding:NSASCIIStringEncoding]];
[[UIApplication sharedApplication] openURL:[NSURL URLWithString:mailString]];
}
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment