Saving incoming msg object to reply later (Serialization Error)

In order to reply, you probably don’t need to save the entire message, just the “from” and “subject” parts. (But you might want to save the whole thing for reference later.)

Note: despite the name, a “Simple Object” column can store any number, string, boolean, list, or dictionary, but not a more general Python object. (See https://anvil.works/docs/data-tables#column-types).

If you can convert msg into a Python dict, where each value in the dict is one of the permitted types, then you can store the resulting dict in that column.

In any case, this new documentation may help: https://anvil.works/docs/email

It’s brand new, so there are still a few loose ends. For example, the docs at the link
https://anvil.works/docs/api/anvil.email#Message
do not (yet) describe the anvil.email.Message object.

If you visit https://anvil.works/docs, you can also Search on “email”. This will actually search beyond the documentation, into relevant tutorials, that may prove helpful.

3 Likes