Jump to content

Pipe Emails To Python Script


topgeardavid

Recommended Posts

Good question. You can put the script anywhere in your account, but I would recommend /home/dr/email.py because that's not accessible through a browser for the extra security.

  • First go to https://tommy.heliohost.org:2083/frontend/paper_lantern/mail/filters/managefilters.html
  • Pick the email address that you want to forward to the script and click manage filters next to it.
  • Click create new filter.
  • Name is "Pipe to Python" or whatever.
  • Set up your rules if you only want certain emails to be piped or all of them, etc.
  • In the actions dropdown box select pipe to a program
  • Enter the path to your python script with a pipe character first, such as |/home/dr/email.py
  • Click create
Then as far as the python script goes you'll need the python shebang for the version you want to use first, and then the email will come to the script along stdin so you can process the text as you would any other stdin input.
Link to comment
Share on other sites

It looks like you forgot the pipe character | That's very important. It should look like

|/home/dr/email_reply.py
Yes, this will only work with filters. Forwarding just takes the email changes the to: field and sends it back through the email system. Filter is what processes the email.
  • Like 1
Link to comment
Share on other sites

Join the conversation

You can post now and register later. If you have an account, sign in now to post with your account.

Guest
Reply to this topic...

×   Pasted as rich text.   Paste as plain text instead

  Only 75 emoji are allowed.

×   Your link has been automatically embedded.   Display as a link instead

×   Your previous content has been restored.   Clear editor

×   You cannot paste images directly. Upload or insert images from URL.

×
×
  • Create New...