jes notes Index Gallery . Signed Distance Functions Shaft passers Snap issues

2025-07-22

Last modified: 2025-07-22 21:49:10

< 2025-07-21

Ruby on rails

Why 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 ". Maybe later I will want to make this reference Contact objects instead. What if a Contact object has more than one name? Maybe we store our canonical name in the Contact table, but we also store the name that was in fact used in the email in an EmailContacts joiner table?

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.

< 2025-07-21