在邮件编辑器中向HTML正文添加新行

3
如何在邮件编辑器的HTML正文中添加换行符?
我有一个字符串:
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];

当我设置邮件编辑器的正文时,我看到没有新行。如何使新行出现?
谢谢提前回复。
1个回答

8
在HTML中,换行应该使用<br />而不是%0D%0A
段落应该使用<p>...</p>标签来表示。
例如,
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];

非常感谢,它起作用了!如何让我的HTML文档中的文本右对齐? - Nava Carmon
@Nava: <p align="right">...</p>。你可以在http://www.w3schools.com/html/default.asp了解更多关于HTML的内容。 - kennytm

网页内容由stack overflow 提供, 点击上面的
可以查看英文原文,
原文链接