Logo Questions Linux Laravel Mysql Ubuntu Git Menu
 

How to open iphone mail application from my own application?

i am working on signup feature. In this feature when the user create account successfully. i am asking him or her to activate his account. i want to open the mail application of iphone if user say yes. now my question is simple how to open mail application from my own application?

like image 944
Faheem Rajput Avatar asked May 09 '12 09:05

Faheem Rajput


People also ask

What app does iPhone use for email?

Apple Mail It comes built into every iPhone, and it supports just about any account type you'd like. It's easy to start new messages. It's fast to do tasks like archive, delete, move to folders, etc.

Does Apple Mail have an app?

"Get the mail.com iOS app and experience powerful mobile email while on the move. The mail.com iOS app brings comprehensive functionality to your mobile device. Perfect for iPhone and iPad users, the free email app from mail.com puts a wealth of productivity tools directly into your hand.

How do I open the Mail app in Swift?

Show activity on this post. let email = "[email protected]" let url = URL(string: "mailto:\(email)") UIApplication. shared. openURL(url!)


2 Answers

#define URLEMail @"mailto:[email protected]?subject=title&body=content"

 NSString *url = [URLEMail stringByAddingPercentEscapesUsingEncoding:NSUTF8StringEncoding ]; 
 [[UIApplication sharedApplication]  openURL: [NSURL URLWithString: url]];
like image 192
adali Avatar answered Sep 18 '22 04:09

adali


Try this out.

-(void)launchMailAppOnDevice
{
    NSString *recipients = @"mailto:[email protected]?subject=subjecthere";
    NSString *body = @"&body=bodyHere";

    NSString *email = [NSString stringWithFormat:@"%@%@", recipients, body];
    email = [email stringByAddingPercentEscapesUsingEncoding:NSUTF8StringEncoding];

    [[UIApplication sharedApplication] openURL:[NSURL URLWithString:email]];
}
like image 32
Mick MacCallum Avatar answered Sep 18 '22 04:09

Mick MacCallum