Current location: Hot Scripts Forums » Programming Languages » Perl » Running a Script from an Email

Running a Script from an Email

Reply
  #1 (permalink)  
Old
New Member
 
Join Date: Sep 2004
Posts: 3
Thanks: 0
Thanked 0 Times in 0 Posts
Running a Script from an Email

I am developing a script that will be activated automatically each time a new email arrives at a specified email address and process the data. I have suceeded in getting the script (Perl) to run when the email arrives and as I track the emails sent from Outlook I get the standard notification to say that the email has arrived:
-------------------------------------------------------------
This is an automatically generated Delivery Status Notification.

Your message has been successfully relayed to the following recipients, but the requested delivery status notifications may not be generated by the destination.

update@newhorizonz.net
--------------------------------------------------------------

Now the problem is that although the script runs and I get emailed back my results I also receive a Mail delivery failed report which says that the script to which I filter the email could not receive the email (although it has because the email ran the script!!):

---------------------------------------------------


This message was created automatically by mail delivery software.

A message that you sent could not be delivered to one or more of its recipients. This is a permanent error. The following address(es) failed:

pipe to |/home/aisamcg/www/cgi-bin/testmail.pl
generated by update@newhorizonz.net
local delivery failed

------ This is a copy of the message, including all the headers. ------

Return-path:
Received: from [195.188.213.5] (helo=smtp-out2.blueyonder.co.uk)
by server68.totalchoicehosting.com with esmtp (Exim 4.34)
id 1CAuzg-0002C2-KA
for update@newhorizonz.net; Fri, 24 Sep 2004 14:40:32 -0400
Received: from NHOFFICE ([82.33.73.66]) by smtp-out2.blueyonder.co.uk with Microsoft SMTPSVC(5.0.2195.6713);
Fri, 24 Sep 2004 19:41:04 +0100
Return-Receipt-To: "new Horizonz"
Reply-To:
From: "new Horizonz"
To:
Subject: test
Date: Fri, 24 Sep 2004 19:40:41 +0100
Organization: new Horizonz
Message-ID:
MIME-Version: 1.0
Content-Type: multipart/alternative;
boundary="----=_NextPart_000_004F_01C4A26E.63196F10"
X-Priority: 3 (Normal)
X-MSMail-Priority: Normal
X-Mailer: Microsoft Outlook, Build 10.0.2616
Importance: Normal
X-MimeOLE: Produced By Microsoft MimeOLE V6.00.2800.1165
Disposition-Notification-To: "new Horizonz"
X-OriginalArrivalTime: 24 Sep 2004 18:41:04.0170 (UTC) FILETIME=[0BCF10A0:01C4A266]

This is a multi-part message in MIME format.

------=_NextPart_000_004F_01C4A26E.63196F10
Content-Type: text/plain;
charset="us-ascii"
Content-Transfer-Encoding: 7bit

test

------=_NextPart_000_004F_01C4A26E.63196F10
Content-Type: text/html;
charset="us-ascii"
Content-Transfer-Encoding: quoted-printable

test
------=_NextPart_000_004F_01C4A26E.63196F10--




--------------------------------------------

Can anyone advise how I can overcome this?

Many thanks

Alan
Reply With Quote

Featured Marketplace Scripts (view more)

  #2 (permalink)  
Old
Coding Addict
 
Join Date: Oct 2003
Location: California
Posts: 359
Thanks: 0
Thanked 0 Times in 0 Posts
Have you checked your mail and error logs yet? Post any errors you come up with.

~Charlie
Reply With Quote
  #3 (permalink)  
Old
New Member
 
Join Date: Sep 2004
Posts: 3
Thanks: 0
Thanked 0 Times in 0 Posts
Nothing in the error log - unfortunately I do not have access to mail logs on my servers. The script is actually doing the work. In CPanel I set up email filtering and filter all mail to update@newhorizonz.net to |/home/....script/path....

The script runs but i still get an email back saying that "pipe to |/home/....script/path.... could not be delivered to the script - although it has!!!

As the script is still very much in early test I was wondering if I need to send something back from the script to acknowledge receipt.
Reply With Quote
  #4 (permalink)  
Old
Coding Addict
 
Join Date: Oct 2003
Location: California
Posts: 359
Thanks: 0
Thanked 0 Times in 0 Posts
Is your script sending anything to STDOUT? If so your mail server is thinking it's an error. When piping mail to a script it shouldn't return anything on success. The mail logs would confirm this though. You may want to contact your host and see if they can grep the logs for you.

~Charlie
Reply With Quote
  #5 (permalink)  
Old
Coding Addict
 
Join Date: Oct 2003
Location: California
Posts: 359
Thanks: 0
Thanked 0 Times in 0 Posts
You can also try to send any return to /dev/null:

Code:
| /path/to/script.pl > /dev/null
~Charlie
Reply With Quote
  #6 (permalink)  
Old
New Member
 
Join Date: Sep 2004
Posts: 3
Thanks: 0
Thanked 0 Times in 0 Posts
Chas

No I'm not using any STDOUT - just sending an email to say the script has run. Later on if I get it working it should read the email, process and file the data. With the > /dev/null I don't even get the email back now.

I have seen similar problems using the autoresponder reported on http://cpanel.net which is what i'm using to set up the email filtering
Reply With Quote
  #7 (permalink)  
Old
Coding Addict
 
Join Date: Oct 2003
Location: California
Posts: 359
Thanks: 0
Thanked 0 Times in 0 Posts
Can you post the code or send it to me via e-mail (piper at dev-null.net)? I have access to a cpanel server where I can try to run it and see what happens. I won't be able to get to it till late tonight/early AM tomorrow at best though.

~Charlie
Reply With Quote
Reply

Bookmarks


Currently Active Users Viewing This Thread: 1 (0 members and 1 guests)
 
Thread Tools
Display Modes

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
Trackbacks are On
Pingbacks are On
Refbacks are On

Forum Jump

Similar Threads
Thread Thread Starter Forum Replies Last Post
Email to DB script radarman012000 ASP 1 09-17-04 02:57 PM
Is there any integrity of script rankings? webmaster@atmanager.com Hot Scripts Forum Questions, Suggestions and Feedback 17 08-06-04 01:12 AM
will pay. php script needed. upload, resize, & email jamjammo Script Requests 4 02-29-04 09:30 PM
accessing existing ISP email with a PHP webmail script. nlancaster PHP 1 01-07-04 04:28 AM
Form to email script with unique ID # webworx Script Requests 0 07-24-03 03:55 AM


All times are GMT -5. The time now is 07:09 AM.
vBulletin® Copyright ©2000 - 2014, Jelsoft Enterprises Ltd.