Getting the body contents of an email programmatically

12 views
Skip to first unread message

Johan Radivoj

unread,
Apr 18, 2024, 8:32:25 AMApr 18
to mu-discuss
Hello,

my $employer adds a rather annoying and unnecessary banner to any incoming email. I would like to strip away that banner when I open a message for reading. I found some inspiration on modifying messages from a previous discussion in the mailing list, but was unable to modify it successfully.

Stripping down the function, If I attempt [0] interactively, body-string will contain the email body contents. If I attempt while hooking into mu4e-view-mode-hook [1], then body-string is empty.

Separately, I found [2] will return the subject of an open email successfully, but when attempting the same with  :body or :text, nil is returned.

What's the idiomatic way of programmatically retrieving the body contents when I have opened up an email in a buffer?

[0]:
(defun my/mail-banner-strip ()
  "Strip banner from emails"
  (interactive)
  (message-goto-body)
  (let* ((body-string (buffer-string)))
    (message "Contents body-string: %s" body-string)))

[1]:
(add-hook 'mu4e-view-mode-hook 'my/mail-banner-strip)

[2]:
(mu4e-message-field (mu4e-message-at-point) :subject)

Zhengyi Fu

unread,
Apr 18, 2024, 8:58:10 AMApr 18
to mu-di...@googlegroups.com
Johan Radivoj <johan....@gmail.com> writes:

> Hello,
>
> my $employer adds a rather annoying and unnecessary banner to any incoming
> email. I would like to strip away that banner when I open a message for
> reading.

Hello Johan,

I'm facing a similar problem and my current solution is:

Johan Radivoj

unread,
Apr 18, 2024, 9:25:48 AMApr 18
to mu-di...@googlegroups.com
Hi Zhengyi,

That actually does exactly what I need, and much cleaner than what I was attempting to walk through and understand. Thank you!

--
Johan Radivoj

--
You received this message because you are subscribed to a topic in the Google Groups "mu-discuss" group.
To unsubscribe from this topic, visit https://groups.google.com/d/topic/mu-discuss/Krmvd2tExPs/unsubscribe.
To unsubscribe from this group and all its topics, send an email to mu-discuss+...@googlegroups.com.
To view this discussion on the web visit https://groups.google.com/d/msgid/mu-discuss/87cyqmkeum.fsf%40fuzy.me.

Hope it will help you.

--
Zhengyi Fu

--
You received this message because you are subscribed to a topic in the Google Groups "mu-discuss" group.
To unsubscribe from this topic, visit https://groups.google.com/d/topic/mu-discuss/Krmvd2tExPs/unsubscribe.
To unsubscribe from this group and all its topics, send an email to mu-discuss+...@googlegroups.com.
To view this discussion on the web visit https://groups.google.com/d/msgid/mu-discuss/87cyqmkeum.fsf%40fuzy.me.

Jerry Lee Daniel

unread,
May 7, 2024, 5:11:38 AMMay 7
to mu-discuss
MT103/202 DIRECT WIRE TRANSFER
PAYPAL TRANSFER
CASHAPP TRANSFER
ZELLE TRANSFER
TRANSFER WISE
WESTERN UNION TRANSFER
BITCOIN FLASHING
BANK ACCOUNT LOADING/FLASHING
IBAN TO IBAN TRANSFER
MONEYGRAM TRANSFER
IPIP/DTC
SLBC PROVIDER
CREDIT CARD TOP UP
DUMPS/ PINS
SEPA TRANSFER
WIRE TRANSFER
BITCOIN TOP UP
GLOBALPAY INC US
SKRILL USA
UNIONPAY RECEIVER

Thanks.


NOTE; ONLY SERIOUS / RELIABLE RECEIVERS CAN CONTACT.

DM ME ON WHATSAPP
+1 (918) 707‑0858

Reply all
Reply to author
Forward
0 new messages