Re: [go-nuts] Attaching to email and extracting email attachments

2017-07-30 Thread jesse junsay
Thank you. Will look into it. On Mon, Jul 31, 2017 at 1:17 AM, Gulácsi Tamás wrote: > If you can decod partially, then Read from the Body and Write to the file. > If it is more complec, then see golang.org/x/text/encoding.Transformer > > jesse junsay

Re: [go-nuts] Attaching to email and extracting email attachments

2017-07-30 Thread Gulácsi Tamás
If you can decod partially, then Read from the Body and Write to the file. If it is more complec, then see golang.org/x/text/encoding.Transformer jesse junsay ezt írta (időpont: 2017. júl. 30., V 19:11): > Hi Guys, > > Last week finally was able to resolve my issue. After

Re: [go-nuts] Attaching to email and extracting email attachments

2017-07-30 Thread jesse junsay
Hi Guys, Last week finally was able to resolve my issue. After looping through the parts and determining which are attachments. All I just need to do is read the file into io.Reader type then decode it and convert it back to []byte and write to file. b64 := base64.NewDecoder(base64.StdEncoding,

Re: [go-nuts] Attaching to email and extracting email attachments

2017-07-26 Thread jesse junsay
@Konstantin K. - Yes been doing that. Have you successfully done this problem before? @Gulacsi - That's where I am right now. Thanks guys. Will let you know if I figure this out... On Wed, Jul 26, 2017 at 5:30 PM, Gulácsi Tamás wrote: > You only need to decode the

Re: [go-nuts] Attaching to email and extracting email attachments

2017-07-26 Thread Gulácsi Tamás
You only need to decode the Transfer-Encoding, and treate the file as Content-Type says. jesse junsay ezt írta (időpont: 2017. júl. 26., Sze, 8:52): > Thank you Tamas... I am already done with identifying each part using the > mime multipart... My main issue now is

Re: [go-nuts] Attaching to email and extracting email attachments

2017-07-26 Thread Konstantin Khomoutov
On Wed, Jul 26, 2017 at 02:52:05PM +0800, jesse junsay wrote: > > Check out github.com/tgulacsi/agostle - it walks the tree of mime parts > > of mail and converts everything to PDF, but you need the walk part only - > > which uses mime/multipart reader basically. > Thank you Tamas... I am already

Re: [go-nuts] Attaching to email and extracting email attachments

2017-07-26 Thread jesse junsay
Thank you Tamas... I am already done with identifying each part using the mime multipart... My main issue now is decoding it back to its binary form and save it to disk... each attachment to its own data format. jpg attachment to file.jpg, pdf attachment to file.pdf and txt attachment to

Re: [go-nuts] Attaching to email and extracting email attachments

2017-07-25 Thread Tamás Gulácsi
Check out github.com/tgulacsi/agostle - it walks the tree of mime parts of mail and converts everything to PDF, but you need the walk part only - which uses mime/multipart reader basically. -- You received this message because you are subscribed to the Google Groups "golang-nuts" group. To

Re: [go-nuts] Attaching to email and extracting email attachments

2017-07-25 Thread jesse junsay
Yes, I've actually tried doing that... but resulting file is gibberish... I might have not done the decoding correctly... Anyway... Thank you... On Wed, Jul 26, 2017 at 1:03 PM, andrey mirtchovski wrote: > I have not done this. It seems relatively easy given the boundary

Re: [go-nuts] Attaching to email and extracting email attachments

2017-07-25 Thread andrey mirtchovski
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.

Re: [go-nuts] Attaching to email and extracting email attachments

2017-07-25 Thread jesse junsay
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

Re: [go-nuts] Attaching to email and extracting email attachments

2017-07-19 Thread jesse junsay
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

Re: [go-nuts] Attaching to email and extracting email attachments

2017-07-18 Thread andrey mirtchovski
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

Re: [go-nuts] Attaching to email and extracting email attachments

2017-07-18 Thread jesse junsay
Hi Andrey, Thank you. I have been trying to figure out how to use your example. But the email that I receive from it are plain text even the encoded attached file. It does not appear as attached but as encoded characters in the mail body. And there is still no attachment seen. I tried

Re: [go-nuts] Attaching to email and extracting email attachments

2017-07-18 Thread jesse junsay
Hi Andrey, Thank you. I have been trying to figure out how to use your example. But the email that I receive from it are plain text even the encoded attached file. It does not appear as attached but as encoded characters in the mail body. And there is still no attachment seen. I tried modifying

Re: [go-nuts] Attaching to email and extracting email attachments

2017-07-15 Thread andrey mirtchovski
the code below which gzips and attaches a file to an email io.Writer has worked for me for close to 5 years. it's not idiomatic go code so don't use it verbatim, only as an example. the boundary is something random the client chooses. i use a sha256 baked into the client. the same for every