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


    Cloudron Forum

    • Register
    • Login
    • Search
    • Categories
    • Recent
    • Tags
    • Popular

    Solved Run script on new email

    Support
    mail
    5
    10
    266
    Loading More Posts
    • 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.
    • yusf
      yusf last edited by girish

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

      girish 1 Reply Last reply Reply Quote 0
      • girish
        girish Staff @yusf last edited by

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

        yusf 1 Reply Last reply Reply Quote 0
        • yusf
          yusf @girish last edited by 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.

          girish murgero 2 Replies Last reply Reply Quote 0
          • robi
            robi last edited by

            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.

            Life of Advanced Technology

            1 Reply Last reply Reply Quote 1
            • girish
              girish Staff @yusf last edited by girish

              @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 Reply Quote 2
              • murgero
                murgero App Dev @yusf last edited by

                @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. ~
                Matrix: @murgero:urgero.org

                yusf 1 Reply Last reply Reply Quote 0
                • yusf
                  yusf @murgero last edited by

                  @murgero Sounds excellent, show me how 😊

                  murgero timconsidine 2 Replies Last reply Reply Quote 0
                  • murgero
                    murgero App Dev @yusf last edited by

                    @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. ~
                    Matrix: @murgero:urgero.org

                    1 Reply Last reply Reply Quote 2
                    • timconsidine
                      timconsidine App Dev @yusf last edited by

                      @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 Reply Quote 2
                      • yusf
                        yusf last edited by

                        Thanks guys, I check out those resources provided ❤

                        1 Reply Last reply Reply Quote 0
                        • Topic has been marked as a question  girish girish 
                        • Topic has been marked as solved  girish girish 
                        • First post
                          Last post
                        Powered by NodeBB