How to write an email with mutt, grep a file and then execute a command on a new email address

I am trying to write a series of scripts that will execute other scripts on my server depending on the text from the email I just received. I am using mutt as a text email client, but I have no idea where to start. I hope to understand how this works more than just solving a problem, because this project is for fun. Thanks!

0


a source to share


3 answers


Another option (which might require more software and / or access depending on your server setup) is to use procmail (or one of the similar software packages) to process the email and run the text of the email body as input in server-side scripts.



+3


a source


The mailing list software does basically what you want. You can register or remove from the mailing list by sending special emails to the list manager. You can look at the open source mailman software to see how they do it and base your solution on a similar approach.



0


a source


the previous answer is correct and perhaps the simplest.

There is another possibility. I am assuming that this email account corresponds to a linux / unix user and that user has a home directory. In the home directory, you can add a file called .forward and then you can forward all incoming mail to either a different address, or pipe the incoming mail to a shell script. The .forward file, as far as I remember, should have execute permission, and also the shell script you forward your email.

It works. I've done this in the past.

0


a source







All Articles