c# - Show only attachment link in mailkit imap -
i want display links of attachments download in mail body without downloading attachment initially. coz don't want download , save attachments on server everytime.
when users clicks link, want download particular attachment(s) gmail server ("https://mail-attachment.googleusercontent.com/attachment/u/1/?xxxx-xxxx")
is there anyway this?
mailkit not provide way of doing because it's not imap supports.
that said, might possible figure out how construct url based on properties of mime attachment.
based on examining download link in 1 of own emails, looks google uses x-attachment-id
header value construct realattid
portion of url. have other variables well, it's hard know other values come from.
the attid
value in download url appears positional value of mime attachment in tree, similar mailkit's bodypart.partspecifier
string.
instead of trying recreate gmail's download link, use mailkit's imapfolder.getbodypart()
api download individual mime parts when user requests them.
in order take advantage of api, you'll need call imapfolder.fetch()
messagesummaryitems.bodystructure
.
you can take @ https://github.com/jstedfast/mailkit/blob/master/samples/imapclientdemo/imapclientdemo/mainwindow.cs see how use messagesummary.body
property fetch
request.
Comments
Post a Comment