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.
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::Messageinstance is also deserialized, however thesparkpost_datamethod is undefined. Since this method is defined inside of themailmethod inDataOptions::InstanceMethods, anyMail::Messageinstance 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 methodsparkpost_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.