Send MMS/email with attachment

Posted on
Tue Jul 19, 2016 12:28 am
rom1011 offline
Posts: 34
Joined: Jan 03, 2016
Location: San Jose, CA

Send MMS/email with attachment

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

Posted on
Tue Jul 19, 2016 12:33 am
racarter offline
User avatar
Posts: 468
Joined: Jun 18, 2016
Location: North Yorkshire, UK

Re: Send MMS/email with attachment

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.

Posted on
Tue Jul 19, 2016 6:42 am
FlyingDiver offline
User avatar
Posts: 7189
Joined: Jun 07, 2014
Location: Southwest Florida, USA

Re: Send MMS/email with attachment

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)?

joe (aka FlyingDiver)
my plugins: http://forums.indigodomo.com/viewforum.php?f=177

Posted on
Tue Jul 19, 2016 7:29 am
jalves offline
Posts: 744
Joined: Jun 16, 2013

Re: Send MMS/email with attachment

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?

Running Indigo 2023.2 on a 24" iMac M1), OS X 14.4
Jeff

Posted on
Tue Jul 19, 2016 1:28 pm
racarter offline
User avatar
Posts: 468
Joined: Jun 18, 2016
Location: North Yorkshire, UK

Re: Send MMS/email with attachment

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

Page 1 of 1

Who is online

Users browsing this forum: No registered users and 1 guest