EWS: How to upload attachment first before sending an email?
I use Exchange Web Service API to do sending email. It is very easy to add attachments by just writing
message.Attachments.AddFileAttachment(attachmentname);
The problem is attaching process happ开发者_JAVA技巧ens in sending process. I found that yahoo, gmail and hotmail they all uploading attachmetns first before you sending the mail. How to do so?
It's the EWS Managed API which does this uploading and sending in one process. But in the background, multiple requests are made to the Exchange server:
- Create the message in the Drafts folder of your mailbox
- Upload the attachments
- Send the items.
If you want to, you can do this yourself. But I don't see the point in doing that. What do you want to accomplish?
If you notice, GMail for example does not use the same manner of attachment. For instance, when you attach something, I am guessing the files get uploaded to some server and then they just provide you with a Link for the download. So I think you can upload the file to some server (be it FTP, or just a database) and then just add the links to the download of the files in the body of the email.
Good luck. I will be looking into the thread to see if there is in fact a way to do this.
Hanlet
精彩评论