UWP EmailMessage linebreak/new 行?
UWP EmailMessage linebreak/new line?
我正在寻找一种在我的 UWP 应用中 EmailMessage()
正文中放置换行符的方法。
我已经尝试过 "\n"
、\r\n
、Environment.NewLine
、<br>
、<br />
,每次它都被省略,无论是在桌面上,还是在移动或两者兼而有之。我尝试使用 Outlook 和 Gmail。
我正在使用 VS2015 更新 3。
谢谢。
编辑:这是代码
public static async Task ComposeEmail(string address, string messageSubject, StorageFile attachmentFile)
{
var emailMessage = new EmailMessage();
emailMessage.Subject = messageSubject;
var lineBreak = Environment.NewLine;
string body = lineBreak + lineBreak + lineBreak + lineBreak + lineBreak + lineBreak + textLoader.GetString("EmailPleaseDontCut") + lineBreak + Info.GetAllInfos();
emailMessage.Body = body;
if (attachmentFile != null)
{
var stream = Windows.Storage.Streams.RandomAccessStreamReference.CreateFromFile(attachmentFile);
var attachment = new EmailAttachment(attachmentFile.Name, stream);
emailMessage.Attachments.Add(attachment);
}
emailMessage.To.Add(new EmailRecipient(address));
await EmailManager.ShowComposeNewEmailAsync(emailMessage);
}
我正在显示这样一封电子邮件,它在正文中将其分成两行
EmailMessage emailMessage = new EmailMessage()
{
Subject = "App Feedback " + Package.Current.DisplayName + " " + ApplicationServices.CurrentDevice,
Body = "First Line\r\nSecondLine"
};
emailMessage.To.Add(new EmailRecipient() { Address = "admin@DotNetRussell.com" });
await EmailManager.ShowComposeNewEmailAsync(emailMessage);
我想我读了关于在 UWP 中发送电子邮件的同一篇文章。您发布的代码看起来与它相同。那个例子很糟糕而且是错误的。我发布的方式效果更好。
我正在寻找一种在我的 UWP 应用中 EmailMessage()
正文中放置换行符的方法。
我已经尝试过 "\n"
、\r\n
、Environment.NewLine
、<br>
、<br />
,每次它都被省略,无论是在桌面上,还是在移动或两者兼而有之。我尝试使用 Outlook 和 Gmail。
我正在使用 VS2015 更新 3。
谢谢。
编辑:这是代码
public static async Task ComposeEmail(string address, string messageSubject, StorageFile attachmentFile)
{
var emailMessage = new EmailMessage();
emailMessage.Subject = messageSubject;
var lineBreak = Environment.NewLine;
string body = lineBreak + lineBreak + lineBreak + lineBreak + lineBreak + lineBreak + textLoader.GetString("EmailPleaseDontCut") + lineBreak + Info.GetAllInfos();
emailMessage.Body = body;
if (attachmentFile != null)
{
var stream = Windows.Storage.Streams.RandomAccessStreamReference.CreateFromFile(attachmentFile);
var attachment = new EmailAttachment(attachmentFile.Name, stream);
emailMessage.Attachments.Add(attachment);
}
emailMessage.To.Add(new EmailRecipient(address));
await EmailManager.ShowComposeNewEmailAsync(emailMessage);
}
我正在显示这样一封电子邮件,它在正文中将其分成两行
EmailMessage emailMessage = new EmailMessage()
{
Subject = "App Feedback " + Package.Current.DisplayName + " " + ApplicationServices.CurrentDevice,
Body = "First Line\r\nSecondLine"
};
emailMessage.To.Add(new EmailRecipient() { Address = "admin@DotNetRussell.com" });
await EmailManager.ShowComposeNewEmailAsync(emailMessage);
我想我读了关于在 UWP 中发送电子邮件的同一篇文章。您发布的代码看起来与它相同。那个例子很糟糕而且是错误的。我发布的方式效果更好。