Page 1 of 1

Is is possible to send attachments via python?

PostPosted: Sun Jul 07, 2019 12:28 pm
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 :-)

Re: Is is possible to send attachments via python?

PostPosted: Sun Jul 07, 2019 12:42 pm
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)

       

Re: Is is possible to send attachments via python?

PostPosted: Sun Jul 07, 2019 3:52 pm
by shrxman
Awesome! thanx for the quick reply. I'll give that a shot tonight. :-)