Differences
This shows you the differences between two versions of the page.
| Both sides previous revision Previous revision Next revision | Previous revision | ||
| indigo_2023.1_documentation:plugins:email [2023/10/13 14:11] – [Sending a Plain Text Email] davel17 | indigo_2023.1_documentation:plugins:email [2025/04/14 20:10] (current) – external edit 127.0.0.1 | ||
|---|---|---|---|
| Line 1: | Line 1: | ||
| + | ====== Email+ ====== | ||
| + | |||
| + | The Email+ plugin is based on the [[https:// | ||
| + | |||
| + | <color blue> | ||
| + | |||
| + | Use the [[https:// | ||
| + | ===== Email Devices and Usage ===== | ||
| + | |||
| + | The plugin provides three types of Indigo devices: you must create instances of the device types below to be able to send and receive emails. | ||
| + | |||
| + | ==== Sending Emails (SMTP Server devices) ==== | ||
| + | |||
| + | The SMTP Server is the device type used for sending emails. To send an email, you first need to create an SMTP device. | ||
| + | |||
| + | If you had a previous version of Indigo configured to send emails, the upgrade process will create this server for you based on your prior settings. The name of that server will be '' | ||
| + | |||
| + | In Indigo, create a new device, in the '' | ||
| + | |||
| + | {{: | ||
| + | |||
| + | You will need to confirm your settings with your email provider. We **highly recommend** using a dedicated email address for Indigo, particularly if you are performing email scans. **NOTE**: it seems that most email providers are now using StartTLS as their encryption method, so if you get an error about //violation of protocol//, you probably need to change it to StartTLS. | ||
| + | ==== Sending an Email ==== | ||
| + | |||
| + | In the Actions tab, you can use the '' | ||
| + | |||
| + | The format can be either plain text or HTML. Variable (''< | ||
| + | |||
| + | === Sending a Plain Text Email === | ||
| + | When sending plain text email messages, simply enter the appropriate text in the Message field. | ||
| + | |||
| + | {{: | ||
| + | |||
| + | === Sending an HTML Email === | ||
| + | |||
| + | {{: | ||
| + | |||
| + | When sending an HTML email, it's your responsibility to ensure that the Message field contains a valid HTML document - we don't attempt to validate it. The plugin supports both simple and more complex HTML constructions. For example, a simple HTML message might look like this: | ||
| + | |||
| + | < | ||
| + | < | ||
| + | <br> | ||
| + | <br> | ||
| + | < | ||
| + | </ | ||
| + | |||
| + | More complex HTML documents are also supported: | ||
| + | |||
| + | < | ||
| + | < | ||
| + | |||
| + | <html lang=" | ||
| + | < | ||
| + | < | ||
| + | <meta name=" | ||
| + | < | ||
| + | body { | ||
| + | background-color: | ||
| + | color: black; | ||
| + | font-family: | ||
| + | } | ||
| + | .foo { | ||
| + | border: solid black 1px; | ||
| + | color: blue; | ||
| + | font-size: 10pt; | ||
| + | padding: 3px; | ||
| + | } | ||
| + | </ | ||
| + | </ | ||
| + | < | ||
| + | < | ||
| + | < | ||
| + | <span class=" | ||
| + | </ | ||
| + | </ | ||
| + | </ | ||
| + | |||
| + | There are several good reference sites for using HTML and CSS such as the Mozilla [[https:// | ||
| + | |||
| + | === Sending Attachments === | ||
| + | Specify attachments by entering the full path to a file with each file separated by commas. For example, | ||
| + | |||
| + | //''/ | ||
| + | |||
| + | (It's not necessary to escape spaces within the path.) | ||
| + | === Sending Event Log Data === | ||
| + | |||
| + | In the Actions tab, you can use the '' | ||
| + | |||
| + | {{: | ||
| + | |||
| + | Variable (''< | ||
| + | |||
| + | === Email+ Actions === | ||
| + | In addition to the '' | ||
| + | |||
| + | == Poll Email Server Actions == | ||
| + | 1. You can use the '' | ||
| + | |||
| + | 2. You can use the '' | ||
| + | |||
| + | == Email Queue Actions == | ||
| + | 3. You can use the '' | ||
| + | |||
| + | 4. You can use the '' | ||
| + | |||
| + | ==== Receiving Emails ==== | ||
| + | |||
| + | There are two server types for receiving email: **IMAP**, which is the most fully-featured and is the best option, and **POP**, an older protocol used by older mail providers. | ||
| + | |||
| + | === IMAP Server === | ||
| + | |||
| + | This is the primary device type used for scanning incoming emails. <color blue> | ||
| + | |||
| + | In Indigo, create a new device, in the '' | ||
| + | |||
| + | {{: | ||
| + | |||
| + | When configuring your **IMAP** device, you will need to confirm the settings with your email provider. The defaults for Encryption and Server Port are usually correct, though that is provider specific. Most email providers '' | ||
| + | |||
| + | There are 3 options for the '' | ||
| + | |||
| + | * '' | ||
| + | * '' | ||
| + | * '' | ||
| + | |||
| + | The '' | ||
| + | == IMAP Mailbox Naming == | ||
| + | |||
| + | When using the option to move processed messages to another mailbox, instead of deleting or leaving in the Inbox, you'll need to specify the name of the destination mailbox. Unfortunately, | ||
| + | |||
| + | There are two primary traits of the naming scheme that vary between servers. First, some servers require all mailboxes to be relative to the INBOX. Others do not. Second, the delimiter used in the mailbox path is not fixed. Most servers use either "/" | ||
| + | |||
| + | So, for a top level mailbox called " | ||
| + | |||
| + | * Processed | ||
| + | * INBOX/ | ||
| + | * INBOX.Processed | ||
| + | |||
| + | To provide some hints that might help determine the correct naming, if the plugin logging is set to " | ||
| + | |||
| + | | ||
| + | | ||
| + | | ||
| + | | ||
| + | | ||
| + | | ||
| + | | ||
| + | | ||
| + | |||
| + | The "/" | ||
| + | |||
| + | |||
| + | === POP Server === | ||
| + | |||
| + | This is an alternative device type used for scanning incoming emails. It is an older protocol but may be the only option you have from your email provider. | ||
| + | |||
| + | If you had a previous version of Indigo configured with email scanning, the upgrade process will create this server for you based on your prior settings. The name of that server will be '' | ||
| + | |||
| + | In Indigo, create a new device, in the '' | ||
| + | |||
| + | {{: | ||
| + | |||
| + | Again, if you want to use **POP** you'll need to confirm the settings with your email provider. | ||
| + | |||
| + | ==== Incoming Email Events ==== | ||
| + | |||
| + | There are a few events that can be used to fire triggers in Indigo. In the Trigger dialog, select Email Event: | ||
| + | |||
| + | {{: | ||
| + | |||
| + | You can use these events to monitor incoming emails (and email errors). You can specify either an IMAP or a POP server as described above. | ||
| + | |||
| + | {{: | ||
| + | |||
| + | * '' | ||
| + | * '' | ||
| + | * '' | ||
| + | ===== Broadcast Messages ===== | ||
| + | |||
| + | Other plugin developers can subscribe to messages from the Email+ plugin when emails are sent or received: | ||
| + | |||
| + | < | ||
| + | Returns dictionary: | ||
| + | { | ||
| + | ' | ||
| + | ' | ||
| + | ' | ||
| + | ' | ||
| + | } | ||
| + | |||
| + | MessageType: | ||
| + | Returns dictionary: | ||
| + | { | ||
| + | ' | ||
| + | ' | ||
| + | ' | ||
| + | ' | ||
| + | } | ||
| + | </ | ||
| + | |||
| + | The plugin id for the plugin is '' | ||
| + | |||
| + | ===== Tips on IMAP Mailbox Naming ===== | ||
| + | When using the IMAP device option to move processed messages to another mailbox, instead of deleting or leaving in the Inbox, you'll need to specify the name of the destination mailbox. Unfortunately, | ||
| + | |||
| + | There are two primary traits of the naming scheme that vary between servers. First, some servers require all mailboxes to be relative to the INBOX. Others do not. Second, the delimiter used in the mailbox path is not fixed. Most servers use either "/" | ||
| + | |||
| + | So, for a top level mailbox called " | ||
| + | |||
| + | * Processed | ||
| + | * INBOX/ | ||
| + | * INBOX.Processed | ||
| + | |||
| + | To provide some hints that might help determine the correct naming, if the plugin logging is set to " | ||
| + | |||
| + | < | ||
| + | | ||
| + | | ||
| + | | ||
| + | | ||
| + | | ||
| + | | ||
| + | | ||
| + | |||
| + | The "/" | ||
| + | ===== Scripting Emails ===== | ||
| + | |||
| + | You can send email messages from Python scripts in one of two ways. | ||
| + | |||
| + | First, you can use the built-in sendEmailTo action defined in the [[https:// | ||
| + | |||
| + | < | ||
| + | |||
| + | This action will use the first SMTP Server device that is found as most users will only have one. | ||
| + | |||
| + | However, if you have multiple SMTP devices and/or you want to add CC or BCC address, you want to send HTML emails, you want to add attachments, | ||
| + | |||
| + | The following function can be called from within your scripts. | ||
| + | Be sure to put in the correct email address and the deviceID for an Email+ SMTP device. | ||
| + | |||
| + | < | ||
| + | def sendAlertEmail(subject, | ||
| + | plugin_id = " | ||
| + | plugin = indigo.server.getPlugin(plugin_id) | ||
| + | if plugin.isEnabled(): | ||
| + | plugin.executeAction( | ||
| + | " | ||
| + | deviceId=12345678, | ||
| + | props={ | ||
| + | ' | ||
| + | ' | ||
| + | ' | ||
| + | } | ||
| + | ) | ||
| + | return | ||
| + | |||
| + | sendAlertEmail(" | ||
| + | </ | ||
| + | |||
| + | There are additional optional properties you can include: | ||
| + | |||
| + | < | ||
| + | ' | ||
| + | ' | ||
| + | ' | ||
| + | ' | ||
| + | ' | ||
| + | ' | ||
| + | ' | ||
| + | } | ||
| + | plugin_id = " | ||
| + | plugin = indigo.server.getPlugin(plugin_id) | ||
| + | if plugin.isEnabled(): | ||
| + | plugin.executeAction( | ||
| + | " | ||
| + | deviceId=12345678, | ||
| + | props=props | ||
| + | ) | ||
| + | </ | ||