Question

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

Was it helpful?

Solution

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];
Licensed under: CC-BY-SA with attribution
Not affiliated with StackOverflow
scroll top