Kumar sonu
Kumar sonu

Reputation: 535

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.

Upvotes: 1

Views: 1267

Answers (2)

Naren
Naren

Reputation: 125

Here is the code for Email

NSString *recipients=[NSString stringWithFormat:@"mailto:[email protected][email protected]&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]];

Upvotes: 0

Henrik P. Hessel
Henrik P. Hessel

Reputation: 36617

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.

Upvotes: 2

Related Questions