Hello,
I would like to send an Email in one of my service.
I use this code and it is working fine:
1InternetAddress from = new InternetAddress(fromAddress, fromName);
2InternetAddress to = new InternetAddress(toAddress, toName);
3MailMessage message = new MailMessage(from, to, subject, body, true);
4MailServiceUtil.sendEmail(message);
But I would like to add an attachment to this email:
I use the code:
1MailMessage message = new MailMessage(from, to, subject, body, true);
2File attachment = new File("com/ordner/content/file.pdf");
3message.addAttachment(attachment);
4MailServiceUtil.sendEmail(message);
But I don't know what path should I use... and where I should put this file on the server.
Thanks and regards,
Mat
Please sign in to flag this as inappropriate.