This is a project I haven't had any experience with, so rather than looking for scripts or exact examples on how this is done, I'm just looking for ideas and how I would go about something like this. Don't leave a message saying "Why don't you go with a premade system" or "Don't do it" or "You can't do this", I'm looking for replies which aid me in the development of this application, not steer me away.

I am writing a mail script for a server (not sure which server yet), but the basic object of this program is to:
1) For the first time ANY email address emails ANY user on the mail server (anyone *@mydomain.com)
2) The autoreply will be an text-image writer, much like Yahoo! and other big companies use so people can't automate their forms. The user is required to type in this validation key and the form submits back to this script and tells the server "Okay, this is a real email address.. let it through"
3) Send an email (if the user isn't verified) to the recipient with a generic. "A user named $name tried to email you a message on $date that was $emailsize kb in size. The email will be delivered once their email account is verified".

Basically, this is a kill-all spam disallowing ANY user to email a person at my domain until they verify their account through a web form which generates image keys.

My questions:
1) How do I write a script for a mail server? I can write Perl/CGI scripts for the most part without a problem, but I have never had to deal with this before. How do I force a mail server to use this script for each email it recieves?
2) What dependencies are there? What information do I need to know about the mailserver/server it's running on before looking deeper into this project?
3) Is Image::Magick the best way to go for the image-text writer? Thanks for your help everyone.


In reply to Writing a script for a mailserver by Anonymous Monk

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.