[Interest] Qt classes to print email to pdf from message in mbox format?

Jeffrey Walton noloader at gmail.com
Tue Nov 7 18:14:35 CET 2023


Thanks Shawn,

On Tue, Nov 7, 2023 at 11:47 AM Shawn Rutledge via Interest
<interest at qt-project.org> wrote:
>
> > On 7 Nov 2023, at 09:28, Jeffrey Walton <noloader at gmail.com> wrote:
> >
> > I've been lurking a while to collect information for an upcoming
> > project. I have not seen a similar topic, so I'm going to ask...
> >
> > I have a collection of email messages in mbox format. I obtain them
> > from GMail, and Export Data operation. I can parse them into
> > individual messages. For each message, I need to virtually display
> > them in a Html-like view, and then print them to a pdf.
> >
> > Lurking and Google search is not turning up useful results. I saw KDE
> > has some gear, like KMBox::MBox, but I want to stay in Qt.
> >
> > My question is, does Qt offer any support for mbox format?
>
> Not that I know of, but I’m sure you can find some C++ code somewhere.
>
> >  Or rich
> > email messages?
> > Or do I need to extract the html parts of the message, and then supply
> > a string to QTextBrowser?
>
> QTextBrowser’s HTML support is not very modern or complete.  If you are not satisfied with the rendering, maybe it’s better to use Qt Webengine.  On the other hand, in that case let’s hope you trust the senders.  It’s becoming rather insecure to let a browser download every remote image etc. that is referenced in every HTML email; so in my mail clients I usually have that feature turned off by default, so that there’s a button to optionally download inline images only occasionally.

Thank you sir.

> This sounds like something to try in Python rather than C++: it sounds like a “scripty” thing to do rather than a long-lived application, you can use Qt, and you can probably find code for mbox pretty easily too.

I had to chuckle when I read the Python comment. I don't have Python
or Perl skills. I go from slow (shell scripts) to fast (C++, Java and
Go). There's no in-between. Lack of Python skill is such a pain point.

Jeff


More information about the Interest mailing list