New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
Send mail with attachment file #403
Comments
I'd say you're serializing the stream for your attachments... Try passing them as a byte array instead or pass some identifier which will let your Hangfire job retrieve the attachments from more permanent storage. When JSON.Net is deserializing your stream it's trying to set properties that can't be set such as "ReadTimeout". |
Many thanks, I will test and feedback soon |
Please don't pass big argument values to Hangfire, keep them as simple as possible. Instead, save your attachments to your storage first and pass their identifiers to background job method. |
I can confirm that byte array instead of Stream works, thank you @IanYates! |
Hello,
I use Hangfire for send background email, but have error when mail has attachment file.
My bug as bellow, pls help to fix
message: "Newtonsoft.Json.JsonSerializationException: Error getting value from 'ReadTimeout' on 'System.IO.MemoryStream'. ---> System.InvalidOperationException: Timeouts are not supported on this stream.
↵ at System.IO.Stream.get_ReadTimeout()
↵ at GetReadTimeout(Object )
↵ at Newtonsoft.Json.Serialization.DynamicValueProvider.GetValue(Object target)
↵ --- End of inner exception stack trace ---
↵ at Newtonsoft.Json.Serialization.DynamicValueProvider.GetValue(Object target)
↵ at Newtonsoft.Json.Serialization.JsonSerializerInternalWriter.CalculatePropertyValues(JsonWriter writer, Object value, JsonContainerContract contract, JsonProperty member, JsonProperty property, JsonContract& memberContract, Object& memberValue)
↵ at Newtonsoft.Json.Serialization.JsonSerializerInternalWriter.SerializeObject(JsonWriter writer, Object value, JsonObjectContract contract, JsonProperty member, JsonContainerContract collectionContract, JsonProperty containerProperty)
↵ at Newtonsoft.Json.Serialization.JsonSerializerInternalWriter.SerializeObject(JsonWriter writer, Object value, JsonObjectContract contract, JsonProperty member, JsonContainerContract collectionContract, JsonProperty containerProperty)
↵ at Newtonsoft.Json.Serialization.JsonSerializerInternalWriter.SerializeList(JsonWriter writer, IEnumerable values, JsonArrayContract contract, JsonProperty member, JsonContainerContract collectionContract, JsonProperty containerProperty)
↵ at Newtonsoft.Json.Serialization.JsonSerializerInternalWriter.SerializeObject(JsonWriter writer, Object value, JsonObjectContract contract, JsonProperty member, JsonContainerContract collectionContract, JsonProperty containerProperty)
↵ at Newtonsoft.Json.Serialization.JsonSerializerInternalWriter.Serialize(JsonWriter jsonWriter, Object value, Type objectType)
↵ at Newtonsoft.Json.JsonSerializer.SerializeInternal(JsonWriter jsonWriter, Object value, Type objectType)
↵ at Newtonsoft.Json.JsonConvert.SerializeObjectInternal(Object value, Type type, JsonSerializer jsonSerializer)
↵ at Astro.Hangfire.Common.JobHelper.ToJson(Object value) in
The text was updated successfully, but these errors were encountered: