iphone - iOS MFMailComposeViewController sent mail but not received -
code:
if ([mfmailcomposeviewcontroller cansendmail]) { mfmailcomposeviewcontroller *mail = [[mfmailcomposeviewcontroller alloc] init]; mail.mailcomposedelegate = self; [mail setsubject:@"sample subject"]; [mail setmessagebody:@"here main text in email!" ishtml:no]; [mail settorecipients:@[@""]]; [self presentviewcontroller:mail animated:yes completion:null]; } else { nslog(@"this device cannot send email"); } - (void)messagecomposeviewcontroller:(mfmessagecomposeviewcontroller *)controller didfinishwithresult:(messagecomposeresult) result { switch (result) { case messagecomposeresultcancelled: break; case messagecomposeresultfailed: { uialertview *warningalert = [[uialertview alloc] initwithtitle:@"error" message:@"failed send sms!" delegate:nil cancelbuttontitle:@"ok" otherbuttontitles:nil]; [warningalert show]; break; } case messagecomposeresultsent: break; default: break; } [self dismissviewcontrolleranimated:yes completion:nil]; }
i use mfmailcomposeviewcontroller send mail. if success message mail not received receiver.
what missing?
errrr, ?
mfmailcomposeviewcontroller *mail = [[mfmailcomposeviewcontroller alloc] init]; . . . [mail settorecipients:@[@""]];
you haven't set "to" email address, , you're complaining email hasn't arrived..?
try this: hard-code email address, use "arraywithobject", , see if email gets sent now:
nsstring *emailaddress = @"mike@isomewhere.com"; mfmailcomposeviewcontroller *mail = [[mfmailcomposeviewcontroller alloc] init]; . . . [mail settorecipients:[nsarray arraywithobject:emailaddress]];
Comments
Post a Comment