0
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 common emails 1.2 和 java 1.4enter code here

4

1 回答 1

0

你能更详细地描述一下吗?因为我认为问题出在您使用以下代码读取文件时:

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

也许当您阅读文件时,使用该脚本时包含了一些字符串?具体我不知道...

于 2013-05-14T08:31:20.130 回答