Skip to content

Commit

Permalink
Merge branch '3-support-multiple-recipients' into 'master'
Browse files Browse the repository at this point in the history
#3: Add support for space separated recipient list

See merge request ix.ai/grafana-email!17
  • Loading branch information
tlex committed Mar 1, 2023
2 parents d2e8ff9 + 3a3e4f6 commit a5885a9
Show file tree
Hide file tree
Showing 2 changed files with 3 additions and 3 deletions.
2 changes: 1 addition & 1 deletion README.md
Original file line number Diff line number Diff line change
Expand Up @@ -25,7 +25,7 @@ You can see the panel url by selecting `Share` in a panel menu (click on its nam
| `GRAFANA_TOKEN` | - | **YES** | the authentication token for Grafana |
| `GRAFANA_DASHBOARD` | - | **YES** | the short code for the dashboard (example: **`gV6maGVZz/e-mail-reports`**) |
| `SMTP_FROM` | - | **YES** | the e-mail address of the sender |
| `SMTP_TO` | - | **YES** | the e-mail address of the receipient |
| `SMTP_TO` | - | **YES** | the e-mail address of the receipient. Alternatively, a space separated list of recipients. |
| `SMTP_PORT` | `25` | NO | the port for the SMTP host |
| `SMTP_HOST` | `localhost` | NO | the SMTP host |
| `SMTP_SUBJECT` | `Grafana Email Report` | NO | the e-mail subject |
Expand Down
4 changes: 2 additions & 2 deletions grafana-email/grafana-email.py
Original file line number Diff line number Diff line change
Expand Up @@ -29,7 +29,7 @@ def __init__(self):

# These are mandatory
self.smtp['from'] = os.environ['SMTP_FROM']
self.smtp['to'] = os.environ['SMTP_TO']
self.smtp['to'] = os.environ['SMTP_TO'].split(' ')
self._token = os.environ['GRAFANA_TOKEN']
self.grafana['dashboard'] = os.environ['GRAFANA_DASHBOARD'] # Example: gV6maGVZz

Expand Down Expand Up @@ -58,7 +58,7 @@ def __init__(self):

self.message['Subject'] = os.environ.get('SMTP_SUBJECT', 'Grafana Email Report')
self.message['From'] = self.smtp['from']
self.message['To'] = self.smtp['to']
self.message['To'] = ', '.join(self.smtp['to'])

LOG.debug(f'Panel options: {self.panel_args}')
LOG.debug(f'SMTP options: {self.smtp}')
Expand Down

0 comments on commit a5885a9

Please sign in to comment.