Unfortunately the webmail I just wrote was under contract so i cant share the code. What I can share is the theory behind what I wrote.

It doesn't take alot to write an webmailer. (A week or so).

These are the modules i used. (ones that i hadn't custom written for this script). use Email::Valid;
use Mail::Mailer;
use Mail::Sendmail;

To prevent abuse, (a very bad thing from here) I set it up so that all the form takes other than the to-be-emailed fields is a hidden "code" field. This field describes a directory in the data directory that contans a config file and display template. Also every field to be sent is descibed in the config file (for data validation and required fields), and any that arent, don't get sent, so people can't make their own version of the form to send wierd things.

The destination email address is hard coded into the config file preventing open use of the script. The one i just wrote supports multiple email address each assigned a name in the config file. The names can be specified in the form, they would get translated by whats in the config file. (multiple names are ok).

A script could probably be built to manage the config files and templates. The config files should probably also be xml, but I was lazy and didn't want to install the expat stuff.

With this system, the referrer is not needed (besides, it can be spoofed), and it sidesteps alot of other problems. (and probably creates a few new ones, but I think overall its more secure.)


In reply to Re: Port 80 Mail Relay (Spammers Welcome?) by bastard
in thread Port 80 Mail Relay (Spammers Welcome?) by ginseng

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.