E-pochtani iPhone va To Subject bilan qanday to'ldirish mumkin?

Biz bilan bog'langan mening ilovamdagi tugma mavjud! IPhone'dagi Eamil mijozini ochishning bir usuli bormi?

0

3 javoblar

MFMailComposeViewController sinf. Apple kompaniyasining MailComposer namunasi :

MFMailComposeViewController *picker = [[MFMailComposeViewController alloc] init];
picker.mailComposeDelegate = self;

[picker setSubject:@"Hello from California!"];

// Set up recipients
NSArray *toRecipients = [NSArray arrayWithObject:@"[email protected]"]; 
[picker setToRecipients:toRecipients];

[self presentModalViewController:picker animated:YES];
[picker release];

MailComposer misolida sizga tashqi pochta ilovasini qanday ochish kerakligi ko'rsatiladi:

NSString *recipients = @"mailto:[email protected]&subject=Hello from California!";
NSString *body = @"&body=It is raining in sunny California!";

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

[[UIApplication sharedApplication] openURL:[NSURL URLWithString:email]];
1
qo'shib qo'ydi
Yordamingiz uchun rahmat.
qo'shib qo'ydi muallif HardCode, manba
Avval tekshirib ko'ring [MFMailComposeViewController canSendMail].
qo'shib qo'ydi muallif picciano, manba

MFMailComposeViewController ni tekshirib ko'ring. Mavzuni, maydonni belgilashingiz va tanangizni HTML bilan to'ldirishingiz mumkin.

0
qo'shib qo'ydi

Amin bo'lishingiz mumkin.

- (void)emailExport:(NSString *)filePath
{
    MFMailComposeViewController *picker = [[MFMailComposeViewController alloc] init];
    picker.mailComposeDelegate = self;

   //Set the subject of email
    [picker setSubject:@"My desired subject"];

   //Add email addresses
   //Notice three sections: "to" "cc" and "bcc"   

    NSString *valueForEmail = @"[email protected]";
    NSString *valueForCCEmail = @"myCcEmail";
    if( valueForEmail == nil ||  [valueForEmail isEqualToString:@""])
    {
        UIAlertView *alert=[[UIAlertView alloc] initWithTitle:@"Please set an email address before sending a time entry!" message:nil delegate:self cancelButtonTitle:@"OK" otherButtonTitles:nil];
        [alert show];
        [alert release];        

        return;
    }
    else {
        [picker setToRecipients:[NSArray arrayWithObjects:valueForEmail, nil]];
    }

    if(valueForCCEmail != nil || ![valueForCCEmail isEqualToString:@""])
    {
        [picker setCcRecipients:[NSArray arrayWithObjects:valueForCCEmail, nil]];
    }

   //Fill out the email body text
    NSString *emailBody = @"My email body text.";

   //This is not an HTML formatted email
    [picker setMessageBody:emailBody isHTML:NO];

   //Show email view  
    [self presentModalViewController:picker animated:YES];

   //Release picker
    [picker release];
}
0
qo'shib qo'ydi