How to read text inside body of mail using javax.mail

This answer extends yurin’s answer. The issue he brought up was that the content of a MimeMultipart may itself be another MimeMultipart. The getTextFromMimeMultipart() method below recurses in such cases on the content until the message body has been fully parsed. private String getTextFromMessage(Message message) throws MessagingException, IOException { if (message.isMimeType(“text/plain”)) { return message.getContent().toString(); } … Read more

How to use the CSV MIME-type?

You could try to force the browser to open a “Save As…” dialog by doing something like: header(‘Content-type: text/csv’); header(‘Content-disposition: attachment;filename=MyVerySpecial.csv’); echo “cell 1, cell 2”; Which should work across most major browsers.

What is the MIME type for Markdown?

tl;dr: text/markdown since March 2016 In March 2016, text/markdown was registered as RFC7763 at IETF. Previously, it should have been text/x-markdown. The text below describes the situation before March 2016, when RFC7763 was still a draft. There is no official recommendation on Gruber’s definition, but the topic was discussed quite heavily on the official mailing-list, … Read more

embedding image in html email

Try to insert it directly, this way you can insert multiple images at various locations in the email. <img src=”data:image/jpg;base64,{{base64-data-string here}}” /> And to make this post usefully for others to: If you don’t have a base64-data string, create one easily at: http://www.motobit.com/util/base64-decoder-encoder.asp from a image file. Email source code looks something like this, but … Read more

Hata!: SQLSTATE[HY000] [1045] Access denied for user 'divattrend_liink'@'localhost' (using password: YES)