开发者

adding new line to html body in mailcomposer

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

I have a string:

NSString *emailBody = [NSString stringW开发者_C百科ithFormat:@"<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


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];
0

上一篇:

下一篇:

精彩评论

暂无评论...
验证码 换一张
取 消

最新问答

问答排行榜