0

I have a confirmation form containing different textFields like Name, Age, Phone no., Email etc. Now i want to use them into mail and send them to the user. I have done that. My application mail is working perfectly fine.

Now i want in the mail which i sent to user through application it should contain these information in structured way. i used string like :

 NSString * bodyMessage = [NSString stringWithFormat:@"Hello  Customer Details:-  Cutomer name: %@,%@,@%",labelName.text, labelEmail.text,labelPhone.text];

But it shows unstructed data.

I want the mail should be :

Name : manjinder
Email: [email protected]
Phone: 098873424345t

How can i display like this.

1
  • You could use HTML. Most mail clients can show HTML. Commented Aug 12, 2011 at 13:47

3 Answers 3

1
... = [NSString stringWithFomat:@"Name\t: %@\r\nEmail\t: %@\r\nPhone\t: %@",
                                labelName.text,
                                labelEmail.text,
                                labelPhone.text];
Sign up to request clarification or add additional context in comments.

Comments

1

Try adding line breaks:

NSString * bodyMessage = [NSString stringWithFormat:@"Hello  Customer Details:-  Cutomer name: %@\n%@\n%@\n",labelName.text, labelEmail.text,labelPhone.text];

Comments

1

You need to use HTML line breaks in the string to accomplish that:

<br />

Just remember to set the HTML flag of the following call that you make on your MFMailComposeViewController:

[myMailController setMessageBody: myEmailBodyString isHTML:YES];

7 Comments

ASCII does support new lines too =).
i am not using MFMailController. i m using third party mail library
Why aren't you using MFMailController?
@Tim: Yep, just adding additional ways this can be accomplished.
@Luke, okay! For example, if he would want to use text-formatting, HTML indeed is the only option available ;)!
|

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service and acknowledge you have read our privacy policy.

Start asking to get answers

Find the answer to your question by asking.

Ask question

Explore related questions

See similar questions with these tags.