Connecting Tech Pros Worldwide Forums | Help | Site Map

mailing from a web-executed perl script.

Nathan
Guest
 
Posts: n/a
#1: Apr 3 '06
This may be a basic task to some of you perl guru's, but I have a
problem getting a perl script i've written, when executed by httpd, to
send out an e-mail.

Basically, i have a few variables passed into this script, it writes
them to a a database, and then its supposed to read the "E-mail list"
attached to that database entry and shoot an e-mail off to everyone in
that list letting them know that there's been an update.
I have what would seem like all of the difficult things done! It takes
the variables, writes them to the database, reads the list (which is
currently only my e-mail address" and then sends the message. The
problem is that the message is empty!
If i execute the script at a shell it works flawlessly (i need to
substitute some variables instead of the HTTP POST that it uses via a
browser, but it works none the less!). I'm starting to wonder weather
its my code or a unix permissions thing.

Basically, when its executed from a shell, it sends the message, the
subject and body are correct, but when i run it from a web browser it
results in a message, with no subject, and no body.

Here's the line which i'm using to try to execute the mail command:

system "/bin/echo $entry | /bin/mail -s \"Log entry added to TN:
$ticketnum\" $emaillist[0]";

I know it may not be the best way to do it, but like i said, it works if
i execute it from a shell. This is my first big perl project, so be
nice. :)

Thanks!
--
In a world with no fences, why do I need Gates?

Nathan
Guest
 
Posts: n/a
#2: Apr 4 '06

re: mailing from a web-executed perl script.


I've gotten this working using sendmail. My script writes the e-mail to
temporary file, and then pipes that file through sendmail.
But, it would still be great to be able to just use a one-liner to send
it through mail instead.

Any suggestions are still welcome.

Thanks!

Nathan wrote:[color=blue]
> This may be a basic task to some of you perl guru's, but I have a
> problem getting a perl script i've written, when executed by httpd, to
> send out an e-mail.
>
> Basically, i have a few variables passed into this script, it writes
> them to a a database, and then its supposed to read the "E-mail list"
> attached to that database entry and shoot an e-mail off to everyone in
> that list letting them know that there's been an update.
> I have what would seem like all of the difficult things done! It takes
> the variables, writes them to the database, reads the list (which is
> currently only my e-mail address" and then sends the message. The
> problem is that the message is empty!
> If i execute the script at a shell it works flawlessly (i need to
> substitute some variables instead of the HTTP POST that it uses via a
> browser, but it works none the less!). I'm starting to wonder weather
> its my code or a unix permissions thing.
>
> Basically, when its executed from a shell, it sends the message, the
> subject and body are correct, but when i run it from a web browser it
> results in a message, with no subject, and no body.
>
> Here's the line which i'm using to try to execute the mail command:
>
> system "/bin/echo $entry | /bin/mail -s \"Log entry added to TN:
> $ticketnum\" $emaillist[0]";
>
> I know it may not be the best way to do it, but like i said, it works if
> i execute it from a shell. This is my first big perl project, so be
> nice. :)
>
> Thanks![/color]


--
In a world with no fences, why do I need Gates?
Closed Thread