开发者

MFMailComposeViewController in iphone app

开发者 https://www.devze.com 2023-02-27 06:37 出处:网络
hii every one can we use\" MFMailComposeViewController \"with out using \" presentModalViewController\" , i mean i need to send email with out navigating to that mail composer page

hii every one

can we use " MFMailComposeViewController " with out using " presentModalViewController" , i mean i need to send email with out navigating to that mail composer page

i did a test project with following code

- (IBAction)buttonPressed {
    arrRecipients = [[NSMutableArray alloc]in开发者_开发百科it];
    [arrRecipients addObject:@"xxxxxxx@gmail.com"];


    MFMailComposeViewController *mailController = [[MFMailComposeViewController alloc] init];
    mailController.mailComposeDelegate = self;
    [mailController setSubject:@"Ravikiran test mail"];
    [mailController setToRecipients:arrRecipients];

    [mailController setMessageBody:@"this is my test app" isHTML:YES];
    [self presentModalViewController:mailController animated:YES];
    [mailController release];
}

it is sending mail but it is navigating to mail composer page & then its sending but i need to send mail just on click of the button


No, you cannot use MFMailComposeViewController to send an email without user interaction. There are probably 3rd parties libraries that let you do this, but the iOS SDK does not allow you to.

Also, you're leaking the arrRecipients array.


Best way for your needs is to have a web service which sends the data to an email id. its always to good to inform the user in some way before sending the mail.

Thanks!

0

精彩评论

暂无评论...
验证码 换一张
取 消

关注公众号