I don't use the camera to actually send the email, rather to post an event to my app which then will send the email.

Although, in the time since I posted and now I've gone beyond just emailing when the camera sees motion. I'm adding zigbee sensor triggers and triggering the camera that way as well.

Eventually, I'll add camera streaming as well, partly because the firmware on my cameras is old, and partly because I want to see if I can make my own home security system based on a Raspberry Pi and Java. I can find others true but I want to write my own completely open source.

But to answer your question;
https://github.com/djr4488/camera-notifier