views:

191

answers:

1

Hi,

How do i add a new line characters to html body of mail composer?

I have a string:

NSString *emailBody = [NSString stringWithFormat:@"<html><b>%%0D%%0AHello,%%0D%%0AHere's a link to your product%%0D%%0A<a href=\"%@\">click here</a>%%0D%%0A best regards</b></html>", currentProduct.url_product_details];

[picker setMessageBody:emailBody isHTML:YES];

When I set the body of a mail composer I see it without new lines. How do i cause new lines to appear?

TIA

A: 

In HTML, newlines are <br />, not %0D%0A.

And use <p>...</p> for a paragraph.

For example,

NSString* emailBody = [NSString stringWithFormat:
 @"<html><head></head><body style='font-weight:bold;'>"
 @"<p>Hello,</p>"
 @"<p>Here's a link to your product<br /><a href='%@'>click here</a></p>"
 @"<p>Best Regards</p>"
 @"</body></html>", currentProduct.url_product_details];
KennyTM
Thanks a lot, it worked! How do say that the text in my html doc should be right-aligned?
Nava Carmon
@Nava: `<p align="right">...</p>`. You can find more about HTML in http://www.w3schools.com/html/default.asp.
KennyTM
again, thanks a lot!
Nava Carmon