0

I am developing an exam app. After the completion of the exam, if the person presses the done button, the results will be sent directly to the person's email.

I know how to use the MessageUI framework, but i don't want to get any compose view - instead it should go directly to the concern email.

Does anybody know if this is possible?

Thanks in advance.

phi
  • 10,634
  • 6
  • 53
  • 88
Kumar
  • 29
  • 6
  • Check out the accepted answer in the following thread for a method on how to send a background email: http://stackoverflow.com/questions/6284599/mfmailcomposeviewcontroller-question-locking-the-fields – Luke Nov 22 '11 at 12:48

2 Answers2

1

For example syntax :

    NSString *msgToSend = @"This is an Example Message to be send";
    NSString *urlStr = [NSString stringWithFormat:@"www.home.com?method=aMethodName&msg=%@",msgToSend]; //here msg is a parameter of your url string
    NSLog(@"%@",urlStr);
    NSURLRequest *request = [[NSURLRequest alloc] initWithURL:[NSURL URLWithString:[urlStr stringByAddingPercentEscapesUsingEncoding:NSUTF8StringEncoding]]];

Hope it gives you an idea...

Maulik
  • 19,348
  • 14
  • 82
  • 137
  • it helps me a lot and make my work easy Thank you very much:-) – Kumar Nov 23 '11 at 07:20
  • i want to give mailed instead of website were asNSString //*urlStr = [NSString stringWithFormat:@"kumar@gmail.com?method=aMethodName&msg=%@",msgToSend];// is it a correct way to do..? i am sending the mail but the mail is not going?????? – Kumar Nov 23 '11 at 08:55
  • No no no... as you mentioned you have web service that sends mail so you have to write web service's URL instead of ""kumar@gmail.com". By this you call the web service by passing the string (your msg)as parameter and your back system receives the msg and take appropriate action to send the mail to the desired location. – Maulik Nov 23 '11 at 09:05
  • i have SMTP for Outgoing How can i configure it to this NSURL? Kindly let me know i am completely new to this iPhone Please. – Kumar Nov 23 '11 at 09:50
  • for that you should contact with your .NET or php team :D – Maulik Nov 23 '11 at 09:57
  • I mean[@"smtp.zaimail.yahoo.comUSERNAME:XYZPASS:XYZ"?method=aMethodName&msg=%@",msgToSend] is it a correct way to put username and password and id? – Kumar Nov 23 '11 at 10:01
-1

This is possible but for this you need a webservice which will send the mail.

Minakshi
  • 1,437
  • 1
  • 11
  • 19
  • ya i have web service can you let me know how? – Kumar Nov 22 '11 at 12:01
  • Then just use it as NSURL and pass the emailid and msg to the url. Actually this will be dependent on how your webservice is designed – Minakshi Nov 22 '11 at 12:09
  • how can i send the msg in NSURL can you give me the Syntax please? – Kumar Nov 22 '11 at 12:17
  • @Maulik: i am new to iPhone can please give me ex: Syntax – Kumar Nov 23 '11 at 05:02
  • @Maulik: i want to give mailed instead of website were asNSString //*urlStr = [NSString stringWithFormat:@"kumar@gmail.com?method=aMethodName&msg=%@",msgToSend];// is it a correct way to do..? i am sending the mail but the mail is not going?????? – Kumar Nov 23 '11 at 07:39