【问题标题】:adding new line to html body in mailcomposer在 mailcomposer 的 html 正文中添加新行
【发布时间】:2010-04-16 12:22:52
【问题描述】:

如何在邮件编写器的 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

【问题讨论】:

    标签: iphone html iphone-sdk-3.0 mfmailcomposeviewcontroller


    【解决方案1】:

    在 HTML 中,换行符是 &lt;br /&gt;,而不是 %0D%0A

    在段落中使用&lt;p&gt;...&lt;/p&gt;

    例如,

    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: &lt;p align="right"&gt;...&lt;/p&gt;。您可以在w3schools.com/html/default.asp 中找到有关 HTML 的更多信息。
    猜你喜欢
    • 2018-04-13
    • 2021-10-24
    • 1970-01-01
    • 2014-08-14
    • 1970-01-01
    • 2021-06-27
    • 1970-01-01
    • 2017-10-08
    • 1970-01-01
    相关资源
    最近更新 更多