Closed sven-peeters-stitchd-be closed 12 months ago
Weird I had a check for it in the code and then resharper complained it was not needed so I removed it. And now the code gives that error :-) .... Always nice a tool that has a split personality
See version 5.4.3 .... also test now :-)
There is no save method in the MailMessage class so I had to use a reflection example from the internet but as usual this works different if you are on the .net framework or .net 5 and 6 so I had to build that in to.... so it took me a while :-)
Throwing a different error now :-( Using .Net6
NullReferenceException: Object reference not set to an instance of an object. This exception was originally thrown at this call stack: System.Net.Mail.Message.PrepareEnvelopeHeaders(bool, bool) System.Net.Mail.Message.Send(System.Net.Mime.BaseWriter, bool, bool) System.Net.Mail.MailMessage.Send(System.Net.Mime.BaseWriter, bool, bool)
It is probably because the reflection works somewhat different in .net 6. I'll have to make a .net 6 test app because the app I used is .net core 3 so there is probably a difference between those .net versions. I'll try to look into this tomorrow today I have to finished something else.
It seems not to be the reflection, I just updated the test project to also target .net 6 and this one worked without any problems with the em file I used
I think it is best that you clone my repository to your local development machine and debug the code yourself to see what is going wrong with your eml file.
No response.... closed
When removing an attcahement from a loaded EML, it throws an argument null exception during the Save operation.
"Value cannot be null. (Parameter 'value')" at System.Net.Mime.MimeBasePart.set_ContentType(ContentType value) at MsgReader.Mime.Message.ToMailMessage() at MsgReader.Mime.Message.Save(Stream messageStream) at MsgReader.Mime.Message.Save(FileInfo file) at Program.$(String[] args) in C:\Users\A1055101\source\repos\DocaMonTest\DocaMonTest\Program.cs:line 57