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

当我设置邮件作曲家的正文时,我看到它没有换行。我如何使新行出现?

TIA

4

1 回答 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];
于 2010-04-16T12:26:11.060 回答