如何在iOS电子邮件中换行

本文关键字:换行 电子邮件 iOS | 更新日期: 2023-09-27 18:31:49

我想在"mailto"标签上换行。这是我在 C# 中的代码

mailto:aaa@gmail.com?subject=My subject&body=I want break in here.%0D%0A Line2 content

我正在使用"%0D%0A"来换行。在我的浏览器中,此代码有效。但是在iPad的电子邮件应用程序中,它无法中断行。请帮帮我

如何在iOS电子邮件中换行

如果你的意思是目标C和使用MFMailComposeViewController你可以使用这样的东西

NSString *emailBody = @"<HTML><BODY><B>It is raining in sunny California!</B><br>this is my second line</BODY></HTML>";
[picker setMessageBody:emailBody isHTML:YES];
- (void) sendEventInEmail
{
    MFMailComposeViewController *picker = [[MFMailComposeViewController alloc] init];
    picker.mailComposeDelegate = self;
    NSArray *toRecipent=[[NSArray alloc]initWithObjects:@"aaa@gmail.com", nil];
    [picker setToRecipients:toRecipents];
    NSString *emailSubject = @"My subject";
    [picker setSubject:emailSubject];
    // Fill out the email body text
    NSString *emailBody = @"1st line<br />2nd line<br />3rd line<br />and so on..."
    [picker setMessageBody:emailBody isHTML:YES];
    picker.navigationBar.barStyle = UIBarStyleBlack;
    [self presentModalViewController:picker animated:YES];
    [picker release];
}
 NSMutableString *emailBody = [NSString stringWithFormat:@"<html> <head><h3>User Detail </h3></head> <body> <table border=0> <tr><td> First Name:<td><font color=color:red> %@ </font></td> </td></tr>  <tr><td>Last Name: <td><font color=color:red> %@ </font></td></td></tr> <tr><td>User Name: <td><font color=color:red> %@ </font></td></td></tr>  <tr><td> Password: <td><font color=color:red>%@</font></td> </td></tr>  <tr><td> Birth Date: <td><font color=color:red>%@</font></td> </td></tr> <tr><td> Location: <td><font color=color:red>%@</font></td> </td></tr> <tr><td>Image :</td></tr></table></body></html> ",msgDataFName,msgDataLName,msgDataUserName,msgDataPswd,msgDataBdate,msgDataLocation];

这是使用HTML标签的整个电子邮件体......