Hi Steffen
I read your comment on my blog but I will reply here instead as the comments section of a blog is not the appropriate place to work through the details of a specific issue.
Firstly, it doesn't matter what is the exact sender adapter type, as generally non file-based sender adapters sets the MIME header with a default file name - MainDocument.xml. For your case, the sender adapter is IDoc, so it matches the particular case and therefore the approach is applicable.
Secondly, for Scenario 1, I just illustrated it with a simple passthrough scenario. The key this for this approach to work is that the filename is stored in Dynamic Configuration, and this is typically done at mapping step. Because the sample was a passthrough scenario, I just constructed a simple Java mapping using the Write Java Mapping directly in ESR! approach. I noticed you already have an IDoc to EDIFACT message mapping in place. As such, you do not need to use a Java mapping to set the Dynamic Configuration value. You can just use a UDF in your existing mapping to construct the required file name and set the Dynamic Configuration value. This is a very common technique and you can find a lot of examples on SCN if you are not familiar on this (hint: even Navdeep's reply below has an example).
Also note that, with this approach, it's still okay for you to add the EDIFACT converter module in the processing chain of the receiver mail channel.
If you are still facing any issues, please provide some screenshot of any errors and the work you have done.
Regards
Eng Swee