mailing from a web-executed perl script.

N

Nathan

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!
 
N

Nathan

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!
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!
 

Ask a Question

Want to reply to this thread or ask your own question?

You'll need to choose a username for the site, which only take a couple of moments. After that, you can post your question and our members will help you out.

Ask a Question

Members online

Forum statistics

Threads
473,755
Messages
2,569,536
Members
45,014
Latest member
BiancaFix3

Latest Threads

Top