I have not done this. It seems relatively easy given the boundary delimiter and some of the mime header information to pick out the file contents by searching forward through the []byte to a delimiter and writing the contents from there to the next delimiter to a file, but I have not done this.
You may consider using something more easily parsable as message content if you're both the sender and the receiver... On Tue, Jul 25, 2017 at 9:08 PM, jesse junsay <[email protected]> wrote: > Hi Andrey, > > I was wondering if you have a sample on how to extract the attachment from > email and save it to disk/file. I tried reverse engineer the sample code of > attaching attachments into an email but cant figure out what to do with the > []byte. > > Have you tried doing this before? Just the opposite of attaching to emails. > This one is taking the attachments from email and save them accordingly to > the harddrive. > > On Wed, Jul 19, 2017 at 11:44 PM, jesse junsay <[email protected]> wrote: >> >> Hey Andrey!!! >> >> That worked, thank you for your example. At least that cleared that part >> out in my mind. And all those other parts like the multipart. Makes sense >> now. Learned a lot too... >> >> Thank you very much I really appreciate it... It already took me more than >> a week. My first time working on this. I do not know how long it would have >> taken me without your help. >> >> Thanks a lot.!!! >> >> On Wed, Jul 19, 2017 at 11:39 AM, andrey mirtchovski >> <[email protected]> wrote: >>> >>> the example you have given is incomplete, but the most likely reason >>> you're not being successful is that you are not setting correctly >>> headers for multipart/mixed mime types. i've created a full working >>> example here, hopefully this helps: >>> >>> https://play.golang.org/p/xVqUDN7OGt >>> >>> for more info on multipart formats: >>> https://www.w3.org/Protocols/rfc1341/7_2_Multipart.html >> >> > -- You received this message because you are subscribed to the Google Groups "golang-nuts" group. To unsubscribe from this group and stop receiving emails from it, send an email to [email protected]. For more options, visit https://groups.google.com/d/optout.
