Options to attach memory buffer to email

26 views
Skip to first unread message

Pavel Odintsov

unread,
Jul 10, 2017, 8:28:04 PM7/10/17
to libcmime-devel
Hello!

I tried to use cmime_part_from_file and it works really well. But I'm looking for options to attach memory region to email because I do not want to dump file to filesystem just to do it. I also tried cmime_part_from_string but it does another job.

Any chance to get this option in your library?

Something like:
cmime_part_from_memory(pointer, pointer_length, attachmen_name);

Thank you!

Axel Steiner

unread,
Jul 12, 2017, 6:35:58 AM7/12/17
to libcmime-devel
Hi Pavel,

the problem, when attaching a mime part from a memory region, is to determine the mime headers respectively mime type of the attachment. 


When attaching mime parts from files, libcmime will look up necessary informations using the „file“

binary and encodes the data to base64. At the moment there is no code in libcmime to classify 

the mime type of data. 


A solution could be a new function (e.g. cmime_part_from_memory) which writes the memory to a temporary

file, which would be processed by cmime_part_from_file(). This would just be a convenience function for the user,

to not write a temporary file by self.


If the writing of a temporary file should be prevented, some own mime detection code must be implemented, which would be a big change. 

Bye,
Axel 

Pavel Odintsov

unread,
Jul 17, 2017, 6:47:31 PM7/17/17
to libcmime-devel
Thanks for a detailed reply, Axel!

I'll try to implement my code and will share it! ;) 
Reply all
Reply to author
Forward
0 new messages