Cloudron makes it easy to run web apps like WordPress, Nextcloud, GitLab on your server. Find out more or install now.


Skip to content
  • Categories
  • Recent
  • Tags
  • Popular
  • Bookmarks
  • Search
Skins
  • Light
  • Cerulean
  • Cosmo
  • Flatly
  • Journal
  • Litera
  • Lumen
  • Lux
  • Materia
  • Minty
  • Morph
  • Pulse
  • Sandstone
  • Simplex
  • Sketchy
  • Spacelab
  • United
  • Yeti
  • Zephyr
  • Dark
  • Cyborg
  • Darkly
  • Quartz
  • Slate
  • Solar
  • Superhero
  • Vapor

  • Default (No Skin)
  • No Skin
Collapse
Brand Logo

Cloudron Forum

Apps | Demo | Docs | Install
  1. Cloudron Forum
  2. Support
  3. Run script on new email

Run script on new email

Scheduled Pinned Locked Moved Solved Support
mail
10 Posts 5 Posters 1.6k Views 4 Watching
  • Oldest to Newest
  • Newest to Oldest
  • Most Votes
Reply
  • Reply as topic
Log in to reply
This topic has been deleted. Only users with topic management privileges can see it.
  • yusfY Offline
    yusfY Offline
    yusf
    wrote on last edited by girish
    #1

    Can I possibly trigger a script to run when email arrives in a Cloudron inbox?

    girishG 1 Reply Last reply
    0
    • yusfY yusf

      Can I possibly trigger a script to run when email arrives in a Cloudron inbox?

      girishG Offline
      girishG Offline
      girish
      Staff
      wrote on last edited by
      #2

      @yusf what kind of script ? sieve essentially does this, can you create a mail rule?

      yusfY 1 Reply Last reply
      0
      • girishG girish

        @yusf what kind of script ? sieve essentially does this, can you create a mail rule?

        yusfY Offline
        yusfY Offline
        yusf
        wrote on last edited by yusf
        #3

        @girish I don’t know as I’ve zero experience with Sieve. I want to curl with POST to an external server. Ideally containing the email contents but at least its sender and subject data.

        girishG murgeroM 2 Replies Last reply
        0
        • robiR Offline
          robiR Offline
          robi
          wrote on last edited by
          #4

          In the old days of mail in unix terminals, you could do that with a .forward file which could run shell scripts.

          What's the bigger purpose?

          Since all email goes through spam filtering, there's an opportunity to hook into what you need there too.

          Conscious tech

          1 Reply Last reply
          1
          • yusfY yusf

            @girish I don’t know as I’ve zero experience with Sieve. I want to curl with POST to an external server. Ideally containing the email contents but at least its sender and subject data.

            girishG Offline
            girishG Offline
            girish
            Staff
            wrote on last edited by girish
            #5

            @yusf generally, the 'robust' way to do this is to implement this, is in the app and not in the mail server. This takes care of situations where the app is down, app is busy etc. For example, chatwoot, freescout, gitlab all have built-in support for IMAP.

            1 Reply Last reply
            2
            • yusfY yusf

              @girish I don’t know as I’ve zero experience with Sieve. I want to curl with POST to an external server. Ideally containing the email contents but at least its sender and subject data.

              murgeroM Offline
              murgeroM Offline
              murgero
              App Dev
              wrote on last edited by
              #6

              @yusf why not run a script in cron (on the cloudron server) that monitors the mailbox via imap?

              --
              https://urgero.org
              ~ Professional Nerd. Freelance Programmer. ~

              yusfY 1 Reply Last reply
              0
              • murgeroM murgero

                @yusf why not run a script in cron (on the cloudron server) that monitors the mailbox via imap?

                yusfY Offline
                yusfY Offline
                yusf
                wrote on last edited by
                #7

                @murgero Sounds excellent, show me how 😊

                murgeroM timconsidineT 2 Replies Last reply
                0
                • yusfY yusf

                  @murgero Sounds excellent, show me how 😊

                  murgeroM Offline
                  murgeroM Offline
                  murgero
                  App Dev
                  wrote on last edited by
                  #8

                  @yusf Sadly I am not sure on specifics, but this answer on stackexchange really goes into detail on options you can do in bash: https://unix.stackexchange.com/a/537196

                  --
                  https://urgero.org
                  ~ Professional Nerd. Freelance Programmer. ~

                  1 Reply Last reply
                  2
                  • yusfY yusf

                    @murgero Sounds excellent, show me how 😊

                    timconsidineT Offline
                    timconsidineT Offline
                    timconsidine
                    App Dev
                    wrote on last edited by
                    #9

                    @yusf depending what you want to do exactly, 2 excellent utilities I have used previously are :

                    • imapfilter (https://github.com/lefcha/imapfilter)
                    • offlineimap (http://www.offlineimap.org/)
                      You will probably need to write the meat of your script in bash or php or whatever, but this will get you access to raw email.
                      And can be run by cron and targeted to mail in certain folders.
                    1 Reply Last reply
                    2
                    • yusfY Offline
                      yusfY Offline
                      yusf
                      wrote on last edited by
                      #10

                      Thanks guys, I check out those resources provided ❤

                      1 Reply Last reply
                      0
                      • girishG girish marked this topic as a question on
                      • girishG girish has marked this topic as solved on
                      Reply
                      • Reply as topic
                      Log in to reply
                      • Oldest to Newest
                      • Newest to Oldest
                      • Most Votes


                      • Login

                      • Don't have an account? Register

                      • Login or register to search.
                      • First post
                        Last post
                      0
                      • Categories
                      • Recent
                      • Tags
                      • Popular
                      • Bookmarks
                      • Search