When I run the following code, the client mail service opens up with the To:, Subject:, Body: except the attachment which is highly needed. I couldn't figure out why the attachment is not adding into the mail.
public static void main(String[] args) throws FileNotFoundException, IOException {
final String HTML = "<h1>Hello</h1>"
+ "<p>This was created using iText</p>"
+ "<a href='hmkcode.com'>hmkcode.com</a>";
String filePath = "C:/Users/HP/Desktop/pdfTest/a.txt";
HtmlConverter.convertToPdf(HTML, new FileOutputStream(filePath, true));
Desktop desktop = Desktop.getDesktop();
try {
// Open user-default mai
// l client application.
String message = "mailto:username@domain.com?subject=New_Profile&body=see%20body%20content&attachment=" + filePath;
URI uri = URI.create(message);
desktop.mail(uri);
} catch (IOException e) {
e.printStackTrace();
}
SpringApplication.run(DemoApplication.class, args);
}