Click here to Skip to main content
Rate this: bad
good
Please Sign up or sign in to vote.
See more: iPhone Objective-C iOS
This is code. Code exectues properly but i am not receiving mail in inbox...
 
#import
i have also set MFMailComposeViewControllerDelegate in interface
 
- (IBAction)SendMailButton:(id)sender
{
 
if ([MFMailComposeViewController canSendMail])
{
MFMailComposeViewController *mailer = [[MFMailComposeViewController alloc] init];
 
mailer.mailComposeDelegate = self;
 
[mailer setSubject:[NSString stringWithFormat:@"Ordered Products & Person Details"]];
 
NSArray *toRecipients = [NSArray arrayWithObjects:@"p41sanjeev@gmail.com", nil];
[mailer setToRecipients:toRecipients];
 

NSString *emailBody =[NSString stringWithFormat:@"Product Ordered\n Product Name & Quantity :%@ \n Contact Person :\n %@ \n Mobile Number 1 :\n %@ \n Mobile Number 2 :\n %@ \n Address : %@ \n Email : %@",[globaldict orderedproduct],name.text,mobileno.text,mobileno1.text,address.text,email.text];
[mailer setMessageBody:emailBody isHTML:NO];
 
[self presentViewController:mailer animated:YES completion:nil];
 

}
else
{
UIAlertView *alert = [[UIAlertView alloc] initWithTitle:@"Failure"
message:@"Your device doesn't support the composer sheet"
delegate:nil
cancelButtonTitle:@"OK"
otherButtonTitles: nil];
[alert show];
 

}
}
 
- (void)mailComposeController:(MFMailComposeViewController*)controller didFinishWithResult:(MFMailComposeResult)result error:(NSError*)error
{
switch (result)
{
case MFMailComposeResultCancelled:
NSLog(@"Mail cancelled: you cancelled the operation and no email message was queued");
break;
case MFMailComposeResultSaved:
NSLog(@"Mail saved: you saved the email message in the Drafts folder");
break;
case MFMailComposeResultSent:
NSLog(@"Mail send: the email message is queued in the outbox. It is ready to send the next time the user connects to email");
break;
case MFMailComposeResultFailed:
NSLog(@"Mail failed: the email message was nog saved or queued, possibly due to an error");
break;
default:
NSLog(@"Mail not sent");
break;
}
 
[self dismissViewControllerAnimated:YES completion:nil];
 
}
 
what is the problem...
Posted 30-May-13 22:00pm
Comments
Michael Haephrati at 1-Jul-13 12:14pm
   
Please indent your source code... What error are you receiving?
SanjeevJayaram at 2-Jul-13 3:10am
   
Actually i tried to send mail through simulator so i didn't get mail. i tried in device and now it works.
I indent the code next time and thanks for your advice :)

This content, along with any associated source code and files, is licensed under The Code Project Open License (CPOL)

  Print Answers RSS
0 OriginalGriff 490
1 Maciej Los 305
2 Richard MacCutchan 270
3 Mathew Soji 220
4 BillWoodruff 210
0 OriginalGriff 8,834
1 Sergey Alexandrovich Kryukov 7,477
2 DamithSL 5,689
3 Maciej Los 5,329
4 Manas Bhardwaj 4,986


Advertise | Privacy | Mobile
Web04 | 2.8.1411028.1 | Last Updated 31 May 2013
Copyright © CodeProject, 1999-2014
All Rights Reserved. Terms of Service
Layout: fixed | fluid

CodeProject, 503-250 Ferrand Drive Toronto Ontario, M3C 3G8 Canada +1 416-849-8900 x 100