If you approach a problem that's not already solved in the core of perl, go to http://search.cpan.org/ and see if there's a module that does what you want. MIME::Lite is often recommended.
That said, sending emails without configuration may work, but many spam protection measures will reject it.
The bare minimum you should have is a proper From-address, and having a DNS entry for that domain that points to the IP of the machine where you send the mail from.
Or even better, use an account on a mail server that is maintained by somebody who knows his job.
Perl 6 - links to (nearly) everything that is Perl 6.
| [reply] |
Obviously, we need considerably more information about what you are trying to do, and what programs you are dealing with.
One strategy that works fairly well, when you are trying to “graft” functionality into a legacy program that doesn’t have it, is to use a separate program that is connected to the first by a FIFO queue, or “pipe.” When the first program wants to (say...) send an e-mail to someone, it writes a record to the pipe, containing the relevant information. The second program, which is asleep waiting for records to arrive in that pipe, then wakes-up and processes the message, independently of the first program and asynchronous to it.
It is usually possible to define pipes to have “many writers” (if you like) “many readers.” So, a single e-mailer program might be able to handle the needs of many client programs. The pipe acts as a convenient, flexible buffer between them.
This is a general approach that can be readily implemented in Perl, but that is not specific to Perl.
| |