user590586
user590586

Reputation: 3050

org.apache.commons.mail attachment file name encoding

I'm using apache commons mail for sending e-mails with attachments. My attachment file content is in hebrew and I can see it when I open the file , my problem is when the attachment file name is in hebrew I can't see the name I see ??? instead. (the content I still see o.k).

this is my code:

String attachment_file_name = "קובץ מס 1";

HtmlEmail email = new HtmlEmail();
email.setHostName(smtp_server);
email.addTo(to_email;
email.setFrom(from_email , "XXXXXXX");
email.setSubject(subject);
email.setCharset("UTF-8");    
email.setHtmlMsg(body);          
email.attach(new ByteArrayDataSource(attachment_file_.toByteArray(), "application/pdf"), 
                                     attachment_file_name , 
                                     "attachment pdf",     
                                     EmailAttachment.ATTACHMENT);                     

email.send();                     

what do I need to do inorder to see the file name in hebrew (in the correct encoding) ?

Thank's In Advance.

Upvotes: 1

Views: 2899

Answers (2)

MJB
MJB

Reputation: 9399

I believe you have to encode it.

Javamail, the core library requires this

Upvotes: 4

Related Questions