小编Fat*_*rza的帖子

如何在MFMailComposeViewController中更改电子邮件的正文?

我想要订购类似订单的东西,如果我完成订单,我想发送电子邮件; 如何修改此代码以更改电子邮件的正文?

inappemailViewController.h

#import <UIKit/UIKit.h>
#import <MessageUI/MFMailComposeViewController.h>

@interface inappemailViewController :
UIViewController <MFMailComposeViewControllerDelegate> {
}

-(IBAction)email;
@end 
Run Code Online (Sandbox Code Playgroud)

inappemailViewController.m

-(IBAction)email {

    MFMailComposeViewController *composer = [[MFMailComposeViewController alloc] init];

    [composer setMailComposeDelegate:self];

    if ([MFMailComposeViewController canSendMail]) {

        [composer setToRecipients:[NSArray arrayWithObjects:@"123@abc.com", nil]];

        [composer setSubject:@"subject here"];

        [composer setMessageBody:@"message here" isHTML:NO];

        [composer setModalTransitionStyle:UIModalTransitionStyleCrossDissolve];

        [self presentModalViewController:composer animated:YES];

        [composer release];

    }

    else

        [composer release];

}

-(void)mailComposeController:(MFMailComposeViewController *)controller didFinishWithResult:(MFMailComposeResult)result error:(NSError *)error {

    if (error) {

        UIAlertView *alert = [[UIAlertView alloc] initWithTitle:@"error"

message:[NSString stringWithFormat:@"error %@", [error description]]

delegate:nil cancelButtonTitle:@"dismiss" otherButtonTitles:nil, nil];

        [alert show]; …
Run Code Online (Sandbox Code Playgroud)

email ios

-1
推荐指数
1
解决办法
2951
查看次数

标签 统计

email ×1

ios ×1