2016-07-13 2 views
2

내 UWP 응용 프로그램에서 EmailMessage()의 본문에 줄 바꿈을 넣을 방법을 찾고 있습니다.UWP EmailMessage linebreak/new line?

이미와 노력 "\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); 
    } 
+0

전자 메일 용 코드를 모두 게시 할 수 있습니까? 방금 며칠 전에 \ r \ n으로이 작업을 수행했으며 잘 작동합니다. –

+0

안녕하세요 @AnthonyRussell! 위의 코드를 살펴보고 잘못된 점을 알려주십시오. 감사. –

+0

String Builder를 사용하고 Environment.NewLine을 추가하지 않는 이유는 무엇입니까? – AVK

답변

1

이 같은 이메일을 보여주는하고 그것이 몸

EmailMessage emailMessage = new EmailMessage() 
{ 
     Subject = "App Feedback " + Package.Current.DisplayName + " " + ApplicationServices.CurrentDevice, 
     Body = "First Line\r\nSecondLine" 
}; 

emailMessage.To.Add(new EmailRecipient() { Address = "[email protected]" }); 
await EmailManager.ShowComposeNewEmailAsync(emailMessage); 

에 두 줄에 그것을 깨고입니다 UWP에서 이메일을 보냅니다. 당신이 올린 코드는 똑같아 보인다. 그 예가 빨려서 틀렸어. 내가 게시 한 방식이 더 효과적입니다.