I need a Perl-script for unattended processing of incoming email message. The script will grab/get incoming email message via POP3 from the request and then process the incoming-message header. The script will reply to the message via Sendmail if and only if incoming-message contains matched strings in the subject line. The string may be a regular expression, (properly quoted and escaped).

In other words, when someone sends an email to info(at)mysite.net on my website, the script (located in cgi-bin directory) grabs the incoming email message. The task of the script will be to process the incoming-message header. If subject-line contains the words "ultimate brochure" (case insensitive), the script replies to the incoming message with a default-message.

I am not an expert in CGI/Perl, nevertheless I am trying to learn fast. After searching the internet for the past three weeks I came about these articles:
i) Accessing Mail via POP3 in Perl & PHP
ii) Sending Mails using Sendmail

My problem is how to write a code that processes the header of incoming email and checks whether the words/expression “ultimate brochure” are included; subsequently send reply.

It will be highly appreciated if somebody can provide me with a script that can accomplish the task postulated above. Many thanks in advance.

Best regards,
Hans Adamsson