Posts: 2
Joined: Tue Oct 09, 2018 9:11 pm

Sending the last picture saved with email

Tue Oct 09, 2018 9:31 pm

Hallow guys...

I just started using Raspberry pi so I’m not good at them so I need your help guys... is it possible to save pictures or videos from a USB CCTV camera into an external hard drive or USB using a Raspberry pi? Assume both (USB CCTV and external hard drive or USB) are connected to a Raspberry pi.

Posts: 175
Joined: Sat Oct 14, 2017 9:57 pm

Re: Sending the last picture saved with email

Wed Oct 10, 2018 12:43 pm


Yes, it's definitely possible. According to your camera, I'm not sure about the details, because you haven't provided the model. But I'm sure with it's driver came an utility (maybe a python script) which reads a picture (jpeg or mjpeg) and saves it as a file. Or it's also possible that the manufacturer has provided a developer documentation explaining the driver's interface, which you can use from your C code (probably involving reading data from a /dev/xxx file).

Now about the email part, you have several options:
1. most simplest one, use libcurl.
2. if curl is too heavy for you, use an smtp-only library, like libquickmail.
3. finally, if you really wanna go hardcore, create a mime-multipart string with your base64 encoded image, and talk smtp directly on a socket connected to the tcp port 25 of a mail relay. Not very complicated, less than 100 SLoC, but you must read RFC5321 first. It's about saying "EHLO", "MAIL FROM", "RCPT TO", "DATA" commands, sending some header lines plus the mime string and terminating with a "." in a single line.


Return to “C/C++”