Sign Up

Sign Up to our social questions and Answers Engine to ask questions, answer people’s questions, and connect with other people.

Have an account? Sign In

Have an account? Sign In Now

Sign In

Login to our social questions & Answers Engine to ask questions answer people’s questions & connect with other people.

Sign Up Here

Forgot Password?

Don't have account, Sign Up Here

Forgot Password

Lost your password? Please enter your email address. You will receive a link and will create a new password via email.

Have an account? Sign In Now

You must login to ask a question.

Forgot Password?

Need An Account, Sign Up Here

Please briefly explain why you feel this question should be reported.

Please briefly explain why you feel this answer should be reported.

Please briefly explain why you feel this user should be reported.

Sign InSign Up

The Archive Base

The Archive Base Logo The Archive Base Logo

The Archive Base Navigation

  • SEARCH
  • Home
  • About Us
  • Blog
  • Contact Us
Search
Ask A Question

Mobile menu

Close
Ask a Question
  • Home
  • Add group
  • Groups page
  • Feed
  • User Profile
  • Communities
  • Questions
    • New Questions
    • Trending Questions
    • Must read Questions
    • Hot Questions
  • Polls
  • Tags
  • Badges
  • Buy Points
  • Users
  • Help
  • Buy Theme
  • SEARCH
Home/ Questions/Q 4531610
In Process

The Archive Base Latest Questions

Editorial Team
  • 0
Editorial Team
Asked: May 21, 20262026-05-21T13:55:34+00:00 2026-05-21T13:55:34+00:00

I have written a small little script that looks up a work on wikipedia

  • 0

I have written a small little script that looks up a work on wikipedia and then prints the result to the command line. I want to be able to email that word to my server and then have my server email me the results back.

So far I have a new user named ‘wiki’ where the e-mails are being sent to. I am receiving the e-mails fine. In /etc/aliases I have redirected incoming emails to my script I wrote.

# See man 5 aliases for format
wiki: "|/home/wiki/scripts/wiki"

That works fine.

My script works find from the command line, as if i typed

$ ./wiki <whatever>

I get permission denied errors when I sent an email to wiki@mydomain.com

My wiki script permissions are:

 -rwxr-xr-x 1 wiki wiki  427 2011-04-18 22:54 wiki

What is wrong! What permissions do I need to set?
Any help is appreciated.

EDIT (4/18/11 8:20pm):
This is my script.

#!/bin/bash

read MSG
echo $MSG >> "newfile"
FROM=$(echo "$MSG" | cut -d " " -f2)
DATA=$(echo "$MSG" | cut -d " " -f3)
if [ MSG ]
then
RTN=`nslookup -q=txt $DATA.wp.dg.cx | grep "text =" | cut -d"=" -f2`

echo $RTN | sendmail -s "wikipedia: '$DATA'" $FROM

else
echo  wilkipedia nslookup. Please supply a command line argument.
fi
  • 1 1 Answer
  • 0 Views
  • 0 Followers
  • 0
Share
  • Facebook
  • Report

Leave an answer
Cancel reply

You must login to add an answer.

Forgot Password?

Need An Account, Sign Up Here

1 Answer

  • Voted
  • Oldest
  • Recent
  • Random
  1. Editorial Team
    Editorial Team
    2026-05-21T13:55:34+00:00Added an answer on May 21, 2026 at 1:55 pm

    This is what I did to take care of my problem…

    1. I scrapped my bash script, and wrote the same function in python. I used python because of its email parsing functionality. I also ran the user input through some string escape prevention code so that I could safely hand it off to python’s subprocess.popen() method.

    2. I was trying to write the stdin to a local file so I could see where to parse the text, however the mail application (mail or postfix, not sure) doesn’t have permissions to write files – Prob a good thing in the end. To debug, I just returned the raw stdin (email header and all) in a string and emailed it back to myself to see what was going on.

    3. I set /etc/aliases to read

      wiki: "|/home/wiki/scripts/wiki.py"

    4. permissions on wiki.py are

      4 -rw-r--r-- 1 wiki mail 1902 2011-04-19 21:04 wiki.py

      and this way the mail program successfully hands it off to your script. You can also go check “/var/log/mail.log” for output if you have errors in your script and nothing gets emailed back to you. If the mail reached the script, but error-ed out because of syntax or a bug, you should get an email reply from MAILER-DAEMON stating that it was undeliverable.

    5. I didn’t use procmail or have a .procmailrc file. /etc/aliases worked just fine. It passes your e-mail to the stdin stream, and in python try this:

    extra=""
    while 1:
    line = sys.stdin.readline()
    if not line:
    break
    extra = extra + line.strip(" ")

    • 0
    • Reply
    • Share
      Share
      • Share on Facebook
      • Share on Twitter
      • Share on LinkedIn
      • Share on WhatsApp
      • Report

Sidebar

Related Questions

I have written a small Perl script and now I would like to create
I have a small AJAX application, written in PHP that I did not secure
Just wondering what little scripts/programs people here have written that helps one with his
I have written a small script in Perl which I am executing on Windows
I have written a small PHP file that gets the information that was posted
I have written a small java application for which I need to obtain performance
As a Christmas gift I have written a small program in Java to calculate
In Ruby I have often written a number of small classes, and had a
I have written an AIR Application that downloads videos and documents from a server.
I have written a site in Prototype but want to switch to jQuery. Any

Explore

  • Home
  • Add group
  • Groups page
  • Communities
  • Questions
    • New Questions
    • Trending Questions
    • Must read Questions
    • Hot Questions
  • Polls
  • Tags
  • Badges
  • Users
  • Help
  • SEARCH

Footer

© 2021 The Archive Base. All Rights Reserved
With Love by The Archive Base

Insert/edit link

Enter the destination URL

Or link to existing content

    No search term specified. Showing recent items. Search or use up and down arrow keys to select an item.