Page 1 of 1

Send MMS/email with attachment

PostPosted: Tue Jul 19, 2016 12:28 am
by rom1011
Hello,
it is possible to send an email to a MMS gateway with an attachment? Am using the builtin mail feature of Indigo already but I haven't found a way to add an attachment. The work-around I can think of is to ask Mail to send the message via AppleScript

Thinks
-Roland

Re: Send MMS/email with attachment

PostPosted: Tue Jul 19, 2016 12:33 am
by racarter
That's exactly what I've done for a similar requirement. When someone rings my doorbell I have a Python script to grab screen shots from the door camera and an AppleScript to send them to me via the Messages app. A bit messy, but it works well.

Like you I couldn't find any other way to send attachments.

Re: Send MMS/email with attachment

PostPosted: Tue Jul 19, 2016 6:42 am
by FlyingDiver
Using my Twilio plugin, you can send MMS messages directly. Requires a Twilio account (a couple bucks a month, depending on usage) and an public internet accessible server to fetch the image from.

I've considered adding the ability to attach files to outgoing emails in my BetterEmail plugin. The main reason I have not is I couldn't figure out a good UI for specifying the attachment. Is the file you want to attach always the same, or do you need a way to specify it for each message? Would it be a local file on the Indigo server, or a URL to a image on the Internet (as would be required for Twilio)?

Re: Send MMS/email with attachment

PostPosted: Tue Jul 19, 2016 7:29 am
by jalves
racarter wrote:
That's exactly what I've done for a similar requirement. When someone rings my doorbell I have a Python script to grab screen shots from the door camera and an AppleScript to send them to me via the Messages app. A bit messy, but it works well.

Like you I couldn't find any other way to send attachments.


Care to share your scripts?

Re: Send MMS/email with attachment

PostPosted: Tue Jul 19, 2016 1:28 pm
by racarter
Sure.

Python script to grab a snapshot from Hikvision DVR ( I actually grab three shots 5 seconds apart):

Code: Select all
import urllib2
import base64
username = "user"
password = "password"
img = "/Users/racarter/Desktop/Snapshots/snap1.jpg"

request = urllib2.Request("http://192.168.0.30/PSIA/Streaming/channels/101/picture")
base64string = base64.encodestring('%s:%s' % (username, password)).replace('\n', '')
request.add_header("Authorization", "Basic %s" % base64string)   
buffer = urllib2.urlopen(request).read()
f = open(img, 'wb')
f.write(buffer)
f.close()



AppleScript to send images in message:

Code: Select all
set theAttachment1 to POSIX file "/Users/racarter/Desktop/Snapshots/snap1.jpg"
set theAttachment2 to POSIX file "/Users/racarter/Desktop/Snapshots/snap2.jpg"
set theAttachment3 to POSIX file "/Users/racarter/Desktop/Snapshots/snap3.jpg"
tell application "Messages"
   send theAttachment1 to buddy "+44xxxxxxxxxx" of service "E:username@mailaddress.com"
   send theAttachment2 to buddy "+44xxxxxxxxxx" of service "E:username@mailaddress.com"
   send theAttachment3 to buddy "+44xxxxxxxxxx" of service "E:username@mailaddress.com"
end tell