Beefy Boxes and Bandwidth Generously Provided by pair Networks
Perl: the Markov chain saw
 
PerlMonks  

Re: I have a .cgi create a file, can I have it automatically FTPed to me or something?

by cidaris (Friar)
on Jun 27, 2002 at 22:08 UTC ( [id://177867]=note: print w/replies, xml ) Need Help??


in reply to I have a .cgi create a file, can I have it automatically FTPed to me or something?

I've always found the easiest way to do this is to e-mail.
Open sendmail as a file and put all the info you need into it. Once you close the e-mail "file" sendmail will ship it off. Depending on your server and volume of e-mail, you should get it nearly instantly.
I have a perl script which does exactly this any time anyone views a home listing on my realty site. It e-mails me the page they looked at, their e-mail address, etc. and I never even have to connect to my server.

Very handy.

open(SM,"|/usr/sbin/sendmail -t"); print SM <<OUT; To: me\@me.net From: server\@yourserver.com Subject: results $msg_text OUT close(SM);
cidaris
  • Comment on Re: I have a .cgi create a file, can I have it automatically FTPed to me or something?
  • Download Code

Replies are listed 'Best First'.
Re: Re: I have a .cgi create a file, can I have it automatically FTPed to me or something?
by sschneid (Deacon) on Jun 27, 2002 at 22:19 UTC
    Sweet! What's the address of your server? I'd love to check out your /etc/passwd file...

    Seriously, though, piping to sendmail is a big, *big* no-no, especially if it's being done through the web with user-entered data. Look at Mail::Send and a more secure way to do the same thing.

    Other than that, I'd definitely suggest e-mailing the file as a great alternative to having to ftp in manually to retrieve the file.

    scott.
      The message text that gets sent out gets run through several checkers first. In my case, if it's not plain old text, it doesn't get sent, just saved to a file, and I get e-mailed about the file's existence.

      However, I'd really like to hear about why it's a *big* big No-No.

      cidaris

Log In?
Username:
Password:

What's my password?
Create A New User
Domain Nodelet?
Node Status?
node history
Node Type: note [id://177867]
help
Chatterbox?
and the web crawler heard nothing...

How do I use this?Last hourOther CB clients
Other Users?
Others wandering the Monastery: (3)
As of 2024-12-06 04:24 GMT
Sections?
Information?
Find Nodes?
Leftovers?
    Voting Booth?
    Which IDE have you been most impressed by?













    Results (39 votes). Check out past polls.