Be very careful, whatever you do. If you're not extremely careful, the forces of darkness will corrupt your script and use it to send spam. I don't know off the top of my head any really good articles that talk about how to make a script like this secure... Does anyone else know of such a thing?

In my own experience, keeping the To: field secure is really important and also really hard. If you can hard code that value, that helps a lot. Also, make sure you quote any arguments to the mail command you use. If you don't and someone says the subject of their email is "foo; rm -r $HOME", you're going to have a bad day.

Really, I'd stay as far away from executing a command from a web script as you possibly can. I've used Net::SMTP, which is great but unwieldy... Previous poster's have recommended things that might help.

I'm paranoid, though, and I fear they're just wrappers around the command line... If they are, you need to stay cautious of what you send them. Do they quote the arguments to the commands they call? Are you sure?

--Pileofrogs


In reply to Re: Sending email using qmail by pileofrogs
in thread Sending email using qmail by keiusui

Title:
Use:  <p> text here (a paragraph) </p>
and:  <code> code here </code>
to format your post, it's "PerlMonks-approved HTML":



  • Posts are HTML formatted. Put <p> </p> tags around your paragraphs. Put <code> </code> tags around your code and data!
  • Titles consisting of a single word are discouraged, and in most cases are disallowed outright.
  • Read Where should I post X? if you're not absolutely sure you're posting in the right place.
  • Please read these before you post! —
  • Posts may use any of the Perl Monks Approved HTML tags:
    a, abbr, b, big, blockquote, br, caption, center, col, colgroup, dd, del, details, div, dl, dt, em, font, h1, h2, h3, h4, h5, h6, hr, i, ins, li, ol, p, pre, readmore, small, span, spoiler, strike, strong, sub, summary, sup, table, tbody, td, tfoot, th, thead, tr, tt, u, ul, wbr
  • You may need to use entities for some characters, as follows. (Exception: Within code tags, you can put the characters literally.)
            For:     Use:
    & &amp;
    < &lt;
    > &gt;
    [ &#91;
    ] &#93;
  • Link using PerlMonks shortcuts! What shortcuts can I use for linking?
  • See Writeup Formatting Tips and other pages linked from there for more info.