If this is your first visit, be sure to
check out the FAQ by clicking the
link above. You may have to register
before you can post: click the register link above to proceed. To start viewing messages,
select the forum that you want to visit from the selection below.

Autoresponder with headerís sensitivity

Hello!

I am trying to code a script for subscription, but I need some help. Just like a program that is an online vacation reply manager with certain exception. In other words, when someone sends an email to the auto-responder, a follow-up begins depending on the content of the header.

My script will be located in cgi-bin directory on my site. The function of the script will be to check the content of header of incoming email. If subject of the incoming-email contains the words ďultimate brochure Ē (case insensitive), the script sends a one-time follow-up email to the subscriber with message in ďbrochure.txtĒ. Let us assume that the sender/subscriber of an email to me put a heading like ďI will like to subscribe for ultimate brochureĒ, the cgi-script must be able to scan the heading to see whether ďultimateĒ and ďbrochureĒ are among the words in the heading. Follow-up email is not sent if both ďultimateĒ and ďbrochureĒ words are not within the content of the heading.

My initial code is as below. It will be highly appreciated if somebody can put me through (in the form of coding) in this my endeavour. I thank you very much in advance for your help and enlightenment. hans.adamsson(at)wippies(dot)fi

Autoresponder with header's sensitivity

Hi Sixtease,

The code is not working. I configured the script's code to my site information. Then I uploaded the script onto my website. I chmod the script (which I named "responder.pl") 755. I chmod "brochure.txt" 777. Then I sent email from another email-address to my site's email-address. I put "ultimate brochure" as the heading of the email. I did not get any reply from the "responder.pl" from my website.

Is there some code missing in the above code you supplied?

If I may explicitly restate what I will like to achieve, I am looking for an autoresponder - A script for receiving a mail and immediately replying, depending on content of the header.

My script will be residing in cgi-bin directory on my site. The function of the script will be to check the content of header of incoming email. If subject of the incoming-email contains the words ďultimate brochureĒ (case insensitive), the script sends a one-time follow-up email to the subscriber with message in ďbrochure.txtĒ. Follow-up email is not sent if both ďultimateĒ and ďbrochureĒ words are not within the content of the heading.

Again I thank you very much in advance for your help and enlightenment.

As I said, my code does not deal at all with getting the incoming email messages from the request.

I suggest you run the code on command line and debug it. You'll have to do some work yourself.

Hint: you can simply implement the get_list_of_messages function which I call in the code but haven't written.

Update: Oh and of course, you have to make sure you have the required modules installed.
And why exactly do you set the brochure.txt file as executable? Wouldn't 644 be more adequate permissions for it?

Ah, I thought you had written the initial code that you posted yourself. For editing the source code, use any text editor you like (preferably one that can highlight Perl syntax).

Executing the code and viewing the output can be done in different ways on different operating systems. In Linux and other Unix-like OS's, just run "perl responder.pl" in the directory where responder.pl resides.
If you use Windows, have a look at Strawberry Perl.

Now tell me, are you sure the code you had originally posted worked? I mean, did it scan and process the email messages? There is one part that looks suspicious to me, and that is the use of the never-declared $pop variable, which I found no mention of in CGI manual.
If it really works, then it looks to me (I really just guess here) that you could simply replace get_list_of_messages with values(%{ $pop->list })
Did you write it yourself? Where do the incoming email messages come from?

Autoresponder with header's sensitivity

Hello Sixtease,

The initial code I posted was not written by me. Going through all the CGI/Perl codes I could found on the internet, I tried to formulate something towards my intended autoreponder. The expression { $pop->list} has no justification. The initial code did not work since I am new to programming in Perl language.

The incoming emails are supposed to come from subscribers any where around the world. Subscribers send emails to, say, info@mywebsite.net on my website. When the subscribers send emails to me, the ďresponder.plĒ (in the cgi-bin directory on my website) processes the emails. The ďresponder.plĒ must be able to check whether there is ďultimate brochureĒ in the content of the header. If the outcome is true, a one-time followup email is sent to the subscriber.

Please can you provide me with some solution/code about this ďget_list_of_messagesĒ function. I thank you very much in advance.

For the past three weeks, I am still struggling to accomplish this task.
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@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.