Is is possible to send attachments via python?

shrxman
Posts: 83
Joined: Wed Apr 22, 2015 2:41 am

Is is possible to send attachments via python?

Post by shrxman »

Hey Joe,

I haven't seen any references regarding using attachments with your plugin via python. I've sent attachments via the GUI, and it works great, and while creating some sort of trigger and interacting with that is possible, it seems a lot more cumbersome than I expect it should be. Is it currently possible to send an email with an attachment via your plugin and python and, if so, do you have an example of how to do that?

thanx for the plugin, by the way. I use it for triggering action groups as well as providing status to myself and others all the time :-)
User avatar
FlyingDiver
Posts: 7830
Joined: Sat Jun 07, 2014 10:36 am
Location: Southwest Florida, USA

Re: Is is possible to send attachments via python?

Post by FlyingDiver »

shrxman wrote:Hey Joe,

I haven't seen any references regarding using attachments with your plugin via python. I've sent attachments via the GUI, and it works great, and while creating some sort of trigger and interacting with that is possible, it seems a lot more cumbersome than I expect it should be. Is it currently possible to send an email with an attachment via your plugin and python and, if so, do you have an example of how to do that?
Just add the other properties as needed. The names of the properties are in the Actions.xml file.

Code: Select all

props = {   
    'emailTo': 'address1, address2', 
    'emailCC': 'address3, address4', 
    'emailBCC': 'address5, address6', 
    'emailSubject': 'Message Subject', 
    'emailAttachments': 'file1, file2, file3', 
    'emailMessage': 'Message text'
}

bePlugin = indigo.server.getPlugin("com.flyingdiver.indigoplugin.betteremail")
if bePlugin.isEnabled():
    bePlugin.executeAction("sendEmail", deviceId=12345678, props=props)

        
joe (aka FlyingDiver)
my plugins: http://forums.indigodomo.com/viewforum.php?f=177
shrxman
Posts: 83
Joined: Wed Apr 22, 2015 2:41 am

Re: Is is possible to send attachments via python?

Post by shrxman »

Awesome! thanx for the quick reply. I'll give that a shot tonight. :-)
Post Reply

Return to “Better Email”