StackStorm-Exchange / stackstorm-email

E-Mail Actions/Sensors for StackStorm
https://exchange.stackstorm.org/
Apache License 2.0
9 stars 45 forks source link

smtp must be configured within imap_mailboxes #6

Closed mickmcgrath13 closed 7 years ago

mickmcgrath13 commented 7 years ago

I was having trouble sending an email with the email pack, and it wasn't until I configured my smtp mailbox within the imap_mailboxes list that it was actually able to send.

This is highly counterintuitive, and I suggest separating out the imap and smtp mailboxes into separate lists.

mickmcgrath13 commented 7 years ago

Additionally, fwiw, because there is an smtp mailbox configured within the imap_mailboxes list, the sensor was failing and not being registered. I temporarily modified /opt/stackstorm/packs/email/sensors/imap_sensor.py to not try to register the smtp sensor as an imap sensor by checking for SMTP: True on the imap_mailbox

This hack should be able to be removed from our code once a new configuration setup has been released.

LindsayHill commented 7 years ago

Ah, that's a good point about having multiple imap_mailboxes configured - it will want to use them all for the IMAP sensor if that is enabled. So yeah, it seems like a good idea to break it out. Rather than nibble at the edges of it, it seems like it would be better to start from a blank sheet of paper, and re-think the pack requirements. Once that's figured out, then update the code. I think most of the code pieces are already there, and it probably doesn't need a huge amount done there - it's more of a design problem than a code problem.

warrenvw commented 7 years ago

Please review the following requirements and configuration file...

Configuration Requirements:

Should be able to configure those independently, might use the same credentials for sending & receiving email, but the imap/smtp servers will be different, with different ports, etc.

All configuration options should be obvious, I should not be configuring SMTP servers underneath imap_mailboxes.

References: https://www.fastmail.com/help/technical/ssltlsstarttls.html

---
sensor_smtp_listen_ip: '127.0.0.1'
sensor_smtp_listen_port: 25
max_attachment_size: 1024
attachment_datastore_ttl: 1800
smtp_accounts:
  - name: personal
    server: "smtp.gmail.com"
    port: 587
    username: "lindsay@stackstorm.com"
    password: "super_S3c4e3t!"
    secure: true
    smtp_auth: true
  - name: work
    server: "imap.example.com"
    port: 465  # this is a deprecated, nonstandard port
    username: "fake@example.com"
    password: "fakepwd"
    secure: true
    smtp_auth: true
imap_accounts:
  - name: personal
    server: "imap.gmail.com"
    port: 993
    username: ""
    password: "super_S3c4e3t!"
    secure: true
  - name: work
    server: "imap.example.com"
    port: 993
    username: "fake@example.com"
    password: "fakepwd"
    secure: true