how to send e-mail without MFMailComposeViewController in iOS? - iphone

How to redirect to mail application from iPhone application?
I have seen in Stack Overflow like MailComposerViewController.
They are sending email from within the iPhone application. But I want to quit project and redirect it to in-built Mail app Which is in iPhone?
How can I do this?
I have tried the following. Are there any frameworks required for this?
- (IBAction)ddd:(id)sender
{
NSString *_recipient = #"someone#email.com";
NSURL *_mailURL = [NSURL URLWithString:[NSString stringWithFormat:#"mailto:%#?subject=My Subject", _recipient]];
[[UIApplication sharedApplication] openURL:_mailURL];
}

No, there are plenty of stackoverflow posts on how to send e-mail without MFMailComposeViewController. In fact, there was at least one response to your request 16 hours earlier that would quit your app and start Mail
Here's how I do it in my apps, copied exactly as it is:
-(IBAction) mailForHelp:(id)sender
{
NSString *urlStr = [NSString stringWithFormat:#"mailto:info#BitsOnTheGo.com?subject=NumMemorize Question"];
NSURL* mailURL = [NSURL URLWithString:[urlStr stringByAddingPercentEscapesUsingEncoding:NSUTF8StringEncoding]];
[[UIApplication sharedApplication] openURL: mailURL];
}

Related

using NSURL Launching iPhoneApp from another App

Im using this code to open AppStore app url , which is working fine am trying to launch then app it self not just open the appstore app page
any tips how i can do this using NSURL
dispatch_async(dispatch_get_main_queue(), ^{
NSURL *appStoreUrl = [NSURL URLWithString:#"https://itunes.apple.com/us/app/cnn-app-for-iphone/id331786748?mt=8"];
[[UIApplication sharedApplication] openURL:appStoreUrl];
});
You can only open the app itself if it supports a custom URL-scheme. Posting from Tweetbot is enabled by opening the url tweetbot:///post?
Alot of pages lists the urls you need to interact with other apps, see for instance http://handleopenurl.com/ or http://wiki.akosma.com/IPhone_URL_Schemes for other examples and apps
[[UIApplication sharedApplication] openURL:[NSURL URLWithString:#"itms://itunes.com/apps/appname"]];

Google Maps link for iOS

I want to have a link to a Google Map on our company mobile website. The problem is, if I make a link, it takes you to the Google Maps website. It needs to open up the app.
I have found out that if you start the url with "comgooglemaps://" it will open google maps. However, this poses the problem that if a iOS user does not have Google Maps installed the link will not work.
Is there a way to open Google Maps if it is installed, but open the browser if not (I don't believe you can open Apple Maps from a website due to the nature of their API)
Thanks
EDIT: Just a heads up, this is being done on a website, not an app. So it needs to be done through HTML, Javascript, PHP etc. NOT a programing language.
Have a look at the Apple Maps Links page.
Basically you link to maps.apple.com and it redirects to Google Maps if needed. Here's an example from the page:
http://maps.apple.com/?daddr=San+Francisco,+CA&saddr=cupertino
With latitude, longitude and zoom:
http://maps.apple.com/?ll=53.01,6.01&z=15
Check this Link
You can use this method with url scheme for google map app. (comgooglemaps://blahblah)
[[UIApplication sharedApplication] canOpenURL:(NSURL*)foo]
It will return BOOL value.
Try this to move google map and set route
NSString* addr = nil;
addr = [NSString stringWithFormat:#"http://maps.google.com/maps?daddr=%1.6f,%1.6f&saddr=Posizione attuale", destinationLat,destinationLong];
NSURL* url = [[NSURL alloc] initWithString:[addr stringByAddingPercentEscapesUsingEncoding:NSUTF8StringEncoding]];
[[UIApplication sharedApplication] openURL:url];
Try this code
if ([[UIApplication sharedApplication] canOpenURL:
[NSURL URLWithString:#"comgooglemaps://"]]) {
NSString * url = [NSString stringWithFormat:#"%#%#,%#",#"http://maps.google.com/maps?q=",#"75.14524",#"12.1521"];
[[UIApplication sharedApplication] openURL:
[NSURL URLWithString:url]];
}

Sending invitation from contact list in iPhone

In an app I have to send invite through contact details in iPhone. I know that contact details can be fetch by ABPeoplePickerNavigationController.And on a button action, I am able to get contact details. Now, on selecting any contact name I should be able to send a mail to that contact user.
Now, please share some information.
Check if the contact has email if it does then,
NSString *subject = [NSString stringWithFormat:#"Subject"];
NSString *mail = [NSString stringWithFormat:#"contact#mail.com"];
NSURL *url = [[NSURL alloc] initWithString:[NSString stringWithFormat:#"mailto:?to=%#&subject=%#",
[mail stringByAddingPercentEscapesUsingEncoding:NSASCIIStringEncoding],
[subject stringByAddingPercentEscapesUsingEncoding:NSASCIIStringEncoding]]];
[[UIApplication sharedApplication] openURL:url];
FYI : If the user hasn't set the email for particular contact then you won't be able to send email anyway :)

How to lunch App-Store with in my iPhone application with list of application of any particular company?

NSString *str = #"itms-apps://itunes.apple.com/in/artist/quizmine-com/id356028414?uo=4";
[[UIApplication sharedApplication] openURL: [NSURL URLWithString:str]];
Above code is working fine in my iPad application but it is not working in my iPhone application why? Can some one help me?
After lunch iTunes Store it through's some message "Your request is not complete".

sending sms and email through program automatically

I have read that In App SMS is finally supported in iPhone OS 4...look at
here
I want to know that if it is also possible to send emails automatically without user's intraction if yes then how?.I mean while our application is running.
No, that's not possible with the official iPhone SDK.
You have to use MFMailComposeViewController or [[UIApplication sharedApplication] openURL: #"sms:12345678"]; or send a text.
Here is the code for Email
NSString *recipients=[NSString stringWithFormat:#"mailto:ABC#gmail.com?cc=bcd#gmail.com&subject=Hi"];
NSString *body=[NSString stringWithFormat:#"&body=How r u "];
NSString *email=[NSString stringWithFormat:#"%#%#",recipients,body];
email=[email stringByAddingPercentEscapesUsingEncoding:NSUTF8StringEncoding];
[[UIApplication sharedApplication] openURL:[NSURL URLWithString:email]];