2011-03-30 45 views

回答

3

SimpleMailMessage只能處理純文本消息,所以你需要嵌入明確的行您的字符串中的破音:

String text = "Hey,\n\nYou are create a new Account!\n\nBest, MyTeam"; 

模板系統,如速度或freemarker可能會使這更容易。

如果要處理HTML消息,則需要使用JavaMailSenderMimeMessagePreparator

0

嘗試

字符串文本=「嘿,你是創建一個新帳戶/ n Best,MyTeam「;

或本(如果必須有一些HTML頁面內)

String text = "Hey, You are create a new Account!<br/> Best, MyTeam"; 

String text = "Hey, You are create a new Account! + System.getProperty("line.separator"); + Best, MyTeam"; 
+0

這不起作用。我收到「嗨,你正在創建一個新賬戶!
Best,MyTeam」 – user6778654 2011-03-30 08:52:14

+0

顯示更多關於它的信息。那個變量在哪裏被調用?你嘗試使用分隔線嗎? – sfrj 2011-03-30 08:55:45