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 |
I haven't messed around with any database programming in Perl, but the answer to your fourth question would be to use a regular expression to pull out the number. For a very simplified example, supposing the there were no other numbers in the email address besides the userlist id (e.g. if they are all formatted as userlist-####@dummy.com) then you can simply store the userlist_id in a scalar variable by saying:
Code:
$email_addr =~ /(\d+)/; Hope this helps, jrtayloriv |
Thanks a lot for helping me out here.
I'll go ahead and try that out. Appreciate your help. Thank You. |
All times are GMT -5. The time now is 08:23 PM. |