Last modified: 2025-07-22 21:49:10
< 2025-07-21Why are we missing body text for some emails?
URL Canary reliably makes emails that appear to have no body.
It's because it was only extracting mail.text_part
, but that is only applicable
on multipart messages. If it's just a plain-text message, then you need mail.body
.
And the next thing is if we're drawing the text part, maybe show it pre-formatted or something?
And auto-link the URLs.
Whoa, actually, ChatGPT tells me that simple_format
is better than pre
, looks good.
And for auto-linking the URLs, it tells me that auto_link
exists, but seems not
available for me.
Apparently was removed, see https://github.com/tenderlove/rails_autolink
I'm using that lib now, works great.
I think simple_format auto_link foo
is safe, but don't completely understand.
ChatGPT doesn't seem upset by it.
Now what about getting the full names in the To/From fields?
Kind of annoying, the "mail" gem has all this DWIM to separate display names from
email addresses, but that's not exactly what I want. For now I am reformatting
it like "Display Name
ChatGPT suggests:
t.references :email, null: false, foreign_key: true
t.references :contact, null: false, foreign_key: true
t.string :used_name # name as it appeared in this particular message
t.string :field # "from", "to", "cc", etc.
t.timestamps
for the EmailContacts table.