Visit Jeremy's Blog.
Go Back > Forums > Linux Forums > Linux - Newbie
User Name
Linux - Newbie This Linux forum is for members that are new to Linux.
Just starting out and have a question? If it is not in the man pages or the how-to's this is the place!


Closed Thread
  Search this Thread
Old 08-24-2005, 11:55 PM   #1
LQ Newbie
Registered: Aug 2005
Posts: 4

Rep: Reputation: 0
Question Running a Perl script with SendMail

I am new to sendmail and just started on Perl. This might be a really basic question, since I know very
little about sendmail or perl, if anyone can help me it would be greatly appreciated.

I will try to be thorough in my explaination... Here's the problem:

I have an email address and have a lists of emaill addresses in a MySQL database (a mailing list).
if a message is sent to the userlists email address, I want a perl script to be executed
that pulls in the list details from a MySQL database, and forwards the message to all the
emails addresses in the list.

Also I wondered if address extensions are possible with sendmail.I mean I wanted to maintain multiple lists
in the database, if a message is recieved with an address like I want to pull the
email address for mailinglist_id 1679 from the database and forward the email to the users in the list.

I am ok with perl programming and can handel the database part of pulling the mailing list etc...
but I'm not at all sure on the SendMail configuration part. My questions are

1) How can I configure sendmail to run a perl script when an email is recieved at
2) How can I take the message from send mail and forward the message to addresses that I pull from the database?
3) Are Address extensions possible in SendMail, if yes then how do I enable that?
4) Can I strip the id (1678 from the address like so that I can use that to query the database for the appropriate list.

I'd really appreciate any help in this regards. Thanks in Advance
Old 08-25-2005, 03:01 AM   #2
Senior Member
Registered: Jan 2002
Location: germany
Distribution: ubuntu, mint, suse
Posts: 1,591

Rep: Reputation: 145Reputation: 145
you may take the form input when a user transmits a message to trigger the perl script i guess if it is send thru a web form. if not you can read out the pop server for incoming mail. There are several modules available to parse emails, headers body...take a look at POP3, MAIL...
Old 08-25-2005, 03:16 AM   #3
LQ Guru
Registered: Jun 2004
Location: Piraeus
Distribution: Slackware
Posts: 12,768

Rep: Reputation: 1843Reputation: 1843Reputation: 1843Reputation: 1843Reputation: 1843Reputation: 1843Reputation: 1843Reputation: 1843Reputation: 1843Reputation: 1843Reputation: 1843
Put an alias in /etc/mail/aliases like this:
uselist: "/path/to/perl/script"
After that run "newaliases" for the changes to take effect.

Old 08-25-2005, 10:50 AM   #4
LQ Newbie
Registered: Aug 2005
Posts: 4

Original Poster
Rep: Reputation: 0
Thanks a lot for helping me out here, I'll go ahead and try that, My other question was whether address extensions are possible with sendmail? Can I use and still be able to recieve the message at the userlist list accpount so that I can strip teh 1678 so that I can use it to pull the mailing list from the DB? Appreciat eyour response. Thanks in Advance.
Old 08-25-2005, 02:02 PM   #5
Registered: Apr 2002
Location: in a fallen world
Distribution: slackware by choice, others too :} ... android.
Posts: 23,067
Blog Entries: 11

Rep: Reputation: 914Reputation: 914Reputation: 914Reputation: 914Reputation: 914Reputation: 914Reputation: 914Reputation: 914
Please do not post the same thread in more than one forum. Picking the most relevant forum and posting it once there makes it easier for other members to help you and keeps the discussion all in one place.

The original is

Closed Thread

Thread Tools Search this Thread
Search this Thread:

Advanced Search

Posting Rules
You may not post new threads
You may not post replies
You may not post attachments
You may not edit your posts

BB code is On
Smilies are On
[IMG] code is Off
HTML code is Off

Similar Threads
Thread Thread Starter Forum Replies Last Post
Running a Perl script with SendMail NewByy Programming 2 08-25-2005 10:56 AM
Running a perl script bobfinners Linux - Software 1 06-23-2005 06:18 PM
running perl script dav_y2k Linux - Newbie 3 04-25-2005 06:00 AM
Running Perl Script upon startup andy7t Linux - Software 1 04-20-2005 05:43 PM
Perl script not running on FreeBSD J_Szucs *BSD 12 07-13-2002 10:05 AM > Forums > Linux Forums > Linux - Newbie

All times are GMT -5. The time now is 09:28 AM.

Main Menu
Write for LQ is looking for people interested in writing Editorials, Articles, Reviews, and more. If you'd like to contribute content, let us know.
Main Menu
RSS1  Latest Threads
RSS1  LQ News
Twitter: @linuxquestions
Open Source Consulting | Domain Registration