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:
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?
.



Relevant Pages

  • Re: Will Linux become as vulnerable as MS ??
    ... > beeing vulnerable to viruses. ... > that they know are executable, and execute intentionally. ... >> Linux, each distro is a little different, and even within the distro, ... > Since clicking on a script is easier than typing it's name, ...
    (comp.os.linux.security)
  • Re: [Full-Disclosure] ColdFusion cross-site scripting security vulnerability of an error page
    ... > execute the arbitrary javascript and HTML code which the attacker ... > It is possible to display the contents transmitted from the client ... > cross-site scripting attack can be executed. ... the script will be executed when the script for an attack ...
    (Full-Disclosure)
  • CGIscript.net - csMailto.cgi - Remote Command Execution
    ... CGIscript.net - csMailto.cgi - Remote Command ... csMailto is a perl cgi formmail script developed by ... execute command on server and mail output to anyone ...
    (Bugtraq)
  • Re: Extracting data from an XML to put into a constant
    ... ExecuteGlobal "Const cnUB = 9" ... The following script causes the same error. ... Ordinary variables and constants defined with execute statements have ... no value until their defining statement is executed at run time. ...
    (microsoft.public.scripting.vbscript)
  • Re: HTTPContext Session and worker thread (Fire and Forget)
    ... Once the page is loaded on the client side, make the request via script ... To kick of the job you insert record into tblJobs with MessageIn having ... not execute job cause it was grabbed by other pooling thread between step 1 ...
    (microsoft.public.dotnet.framework.aspnet)