Skip to content

sparkpost_datais not persisted when mail is deserialized #59

@silvabox

Description

@silvabox

We are using sparkpost_rails with DelayedJob. DelayedJob serializes the mail object to a database table using YAML, for later execution. When the job is deserialized from YAML, its enclosed Mail::Message instance is also deserialized, however the sparkpost_data method is undefined. Since this method is defined inside of the mail method in DataOptions::InstanceMethods, any Mail::Message instance created outside of this method (e.g. through deserialization) will not have the method present. This means all of our emails fail to send, with (e.g.) #<NoMethodError: undefined method sparkpost_data' for #Mail::Message:0x00007f90cdcc22d8>`.

I'll fork the code and experiment with some possible fixes, but if there's an obvious/ preferred approach, please do let me know and I'll pursue it.

Metadata

Metadata

Assignees

No one assigned

    Labels

    No labels
    No labels

    Type

    No type

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions