使用apache HTMLEmail发送电子邮件附件时,邮件正文中会有额外的行

时间:2013-02-25 07:18:43

标签: apache apache-commons

I am using following java code to send email ticket which is Html code in a mail body and also sending same  ticket as attachment a html file. but  some extra lines coming in the body for email clients other than Microsoft outlook like g mail etc,Here is the code,

HtmlEmail service = new HtmlEmail();
//getting body as Html content    
String `strBodyText` = getSpotTicketContent(bobTicketVO,strBhLogoCid);      
FileWriter fw = new FileWriter(file.getAbsoluteFile());      
BufferedWriter bw = new BufferedWriter(fw);   
bw.write(strBodyText);    
bw.close();     
URL filePath = new URL("file:///"+file.getPath());      
service.attach(filePath, ""+orderType+""+dealID+".html""Baydonhill Order Ticket");     
service.send();    

每一件事似乎都是精美的依恋和身体正常来临,除了一个额外的线来到身体,如------ = _ Part_8_20713850.1361775519720 -

我正在使用Apache常见电子邮件1.2和java 1.4 enter code here

1 个答案:

答案 0 :(得分:0)

你能描述一下它的细节吗? 因为我认为问题是当你用这段代码读取文件时:

FileWriter fw = new FileWriter(file.getAbsoluteFile());      
BufferedWriter bw = new BufferedWriter(fw);   
bw.write(strBodyText);    
bw.close();     

也许在您阅读文件时,使用该脚本时会包含一些字符串? 我完全不知道......