LinuxQuestions.org
Register a domain and help support LQ
Go Back   LinuxQuestions.org > Forums > Linux Forums > Linux - Newbie
User Name
Password
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!

Notices


Closed Thread
  Search this Thread
Old 08-24-2005, 11:55 PM   #1
NewByy
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 userlist@dummy.com 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 userlists-1678@dummy.com. 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 userlist@dummy.com?
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 userlists-1678@dummy.com) 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
j-ray
Senior Member
 
Registered: Jan 2002
Location: germany
Distribution: ubuntu
Posts: 1,534

Rep: Reputation: 132Reputation: 132
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 search.cpan.org: POP3, MAIL...
 
Old 08-25-2005, 03:16 AM   #3
bathory
LQ Guru
 
Registered: Jun 2004
Location: Piraeus
Distribution: Slackware
Posts: 11,605

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

Regards
 
Old 08-25-2005, 10:50 AM   #4
NewByy
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 userlist-1678@dummy.com 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
Tinkster
Moderator
 
Registered: Apr 2002
Location: in a fallen world
Distribution: slackware by choice, others too :} ... android.
Posts: 23,067
Blog Entries: 11

Rep: Reputation: 910Reputation: 910Reputation: 910Reputation: 910Reputation: 910Reputation: 910Reputation: 910Reputation: 910
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.

http://www.linuxquestions.org/rules.php

The original is
http://www.linuxquestions.org/questi...18#post1818518
 
  


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


All times are GMT -5. The time now is 08:38 PM.

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