[opencms-dev] send mail with attachment from CmsHtmlMail
Juan Antonio Benitez
mckarthy at gmail.com
Thu Feb 8 09:19:34 CET 2007
hello, I am trying to send an e-mail with opencms 6.2.2, but I cannot add
attached files to him, I have proven with the following lines of code:
try
{
CmsHtmlMail mail = new CmsHtmlMail();
EmailAttachment attachm = new EmailAttachment();
attachm.setName("file.txt");
attachm.setDisposition(EmailAttachment.ATTACHMENT);
attachm.setDescription("File with text");
attachm.setPath("C:\\file.txt");
mail.setFrom("from at domain.com");
mail.addTo("to at domain.com");
mail.setSubject("subject");
mail.setMsg("message");
mail.attach( attachm );
mail.send();
out.println("<h1>Correct</h1>");
}
catch (MessagingException e)
{
out.println(e.toString());
}
and it gives east error me:
javax.mail.MessagingException: Cannot attach file "C:\file.txt";
nested exception is: java.io.IOException: "C:\file.txt" does not exist
nevertheless, in Eclipse, this code works correctly. Also I have tried to
send a file that this in the VSF and does not work
either. If somebody knows like solving to my problem estaria him very
thanked for
Thank you very much by your aid. A greeting.
-------------- next part --------------
An HTML attachment was scrubbed...
URL: <https://webmail.opencms.org/pipermail/opencms-dev/attachments/20070208/5e9f8e91/attachment.htm>
More information about the opencms-dev
mailing list