rnwood / smtp4dev

smtp4dev - the fake smtp email server for development and testing
BSD 3-Clause "New" or "Revised" License
3.07k stars 344 forks source link

Attachment not shown in message view and can't download the attachment #236

Closed nveskovic closed 4 years ago

nveskovic commented 4 years ago

smtp4dev Version: Smtp4dev-win-x64-v3.1.0-ci0939 OS: win 10, smtp4dev is running as service with default appsettings.json

No option to view/download attachment here image

But it is shown in this view image

And in this view image

However , when I click on Download button for the whole message, save it as .eml file and open it from MS Outlook, I can see the attachment there and save it from MS Outlook

image


/Message/<id> is returning this

{
   "id":"c68986f6-dd28-45c3-afcd-86bd2271d8a2",
   "from":"eeeeee@fsdfs.sd",
   "to":"body1",
   "cc":"",
   "bcc":"",
   "receivedDate":"2020-02-20T18:00:29.2462838",
   "subject":"body1",
   "parts":[
      {
         "id":"0",
         "headers":[
            {
               "name":"Content-type",
               "value":"multipart/mixed; boundary=\"63b240bafd084013979c48f3f3ef85a3\""
            }
         ],
         "childParts":[
            {
               "id":"1",
               "headers":[
                  {
                     "name":"Content-Type",
                     "value":"text/plain; charset=us-ascii"
                  },
                  {
                     "name":"Content-Disposition",
                     "value":"inline"
                  }
               ],
               "childParts":[

               ],
               "name":" - text/plain",
               "messageId":"c68986f6-dd28-45c3-afcd-86bd2271d8a2",
               "contentId":null,
               "attachments":[

               ],
               "size":105
            },
            {
               "id":"2",
               "headers":[
                  {
                     "name":"Content-Type",
                     "value":"application/pdf; name=03-2019 Beyond42 Doo.pdf"
                  },
                  {
                     "name":"Content-Transfer-Encoding",
                     "value":"base64"
                  }
               ],
               "childParts":[

               ],
               "name":" - application/pdf",
               "messageId":"c68986f6-dd28-45c3-afcd-86bd2271d8a2",
               "contentId":null,
               "attachments":[

               ],
               "size":79979
            }
         ],
         "name":" - multipart/mixed",
         "messageId":"c68986f6-dd28-45c3-afcd-86bd2271d8a2",
         "contentId":null,
         "attachments":[

         ],
         "size":80278
      }
   ],
   "headers":[
      {
         "name":"Subject",
         "value":"body1"
      },
      {
         "name":"From",
         "value":"eeeeee@fsdfs.sd"
      },
      {
         "name":"Date",
         "value":"Thu, 20 Feb 2020 18:00:29 +0100"
      },
      {
         "name":"To",
         "value":"body1"
      },
      {
         "name":"X-Mailer",
         "value":"SRCMimeMessage"
      },
      {
         "name":"Mime-version",
         "value":"1.0"
      }
   ],
   "mimeParseError":null
}
rnwood commented 4 years ago

This was because the mime part containing the attachment was not correctly described with a "Content-disposition: attachment" header. Upon investigation, it appear that this practice is quite common.

The identification of which parts are attachments has been adjusted to take this into account however a warning will be displayed when viewing the message, as I believe it's quite likely there will be other clients that don't make allowances for this.

nveskovic commented 4 years ago

hey @rnwood

thanks for the prompt reply. are you saying next release will support this scenario by allowing to download attachment but with some warning that mime part is not descriebed correctly?

At least this is how I understood your comment

cheers


EDIT: actually you can igonore the above, I see this commit #236 eda3bb339a447b15fbf504cb7d035d6cd9060d2f