ProgrammingThis forum is for all programming questions.
The question does not have to be directly related to Linux and any language is fair game.
Notices
Welcome to LinuxQuestions.org, a friendly and active Linux Community.
You are currently viewing LQ as a guest. By joining our community you will have the ability to post topics, receive our newsletter, use the advanced search, subscribe to threads and access many other special features. Registration is quick, simple and absolutely free. Join our community today!
Note that registered members see fewer ads, and ContentLink is completely disabled once you log in.
If you have any problems with the registration process or your account login, please contact us. If you need to reset your password, click here.
Having a problem logging in? Please visit this page to clear all LQ-related cookies.
Get a virtual cloud desktop with the Linux distro that you want in less than five minutes with Shells! With over 10 pre-installed distros to choose from, the worry-free installation life is here! Whether you are a digital nomad or just looking for flexibility, Shells can put your Linux machine on the device that you want to use.
Exclusive for LQ members, get up to 45% off per month. Click here for more info.
Distribution: Ubuntu 7.10, OpenSUSE 10.3, Linux Mint, Arch
Posts: 92
Rep:
email-based interface
Here's what I want to do:
I want to send an email to a email-address with some data in the subject line(or maybe the body, doesn't really matter), then take that data, use it as an argument in a script, and then send the result the processed data back to the sending address.
Distribution: Solaris 9 & 10, Mac OS X, Ubuntu Server
Posts: 1,197
Rep:
You're talking about this being an automated process?
If the other end is running Sendmail, then you can do this. It requires a couple of things. First, you need your program or script that processes the email. Then you need to put a symlink to that script in /var/adm/sm.bin. That is essentially the list of programs that are allowed to be called directly from sendmail. Then you need to put an entry in /etc/mail/aliases. This will be the name you send mail to. It will be something like:
namex: realname,"| /var/adm/sm.bin/programname"
So, if you send mail to namex on that machine, it will send a copy of the mail to realname on that machine and another copy will get piped to programname.
If you are using something other than sendmail, then it will be different, but the same idea. It is similar to the way that procmail and hypermail have to be set up. So, if you are on another type of mail server, you can look for instructions for setting up those.
Distribution: Ubuntu 7.10, OpenSUSE 10.3, Linux Mint, Arch
Posts: 92
Original Poster
Rep:
Automated, yes!
I need to digest that at bit, but do both ends need to use sendmail? I actually don't know what my server uses... How can I check that. But you say that you can do this with other mail servers.
Distribution: Solaris 9 & 10, Mac OS X, Ubuntu Server
Posts: 1,197
Rep:
If you are not the server admin, then you'll have to check with that person. Show them your script or what you want to do, and they would have to set up the mail server to allow it.
You simply send a mail from whatever mail client you use to namex at the server.
I actually have an instance where a data collection computer at a research site sends automated emails to our server. They are processed through a script as described above and the data shows up in graphs on our website.
LinuxQuestions.org is looking for people interested in writing
Editorials, Articles, Reviews, and more. If you'd like to contribute
content, let us know.