Softpanorama

May the source be with you, but remember the KISS principle ;-)
Home Switchboard Unix Administration Red Hat TCP/IP Networks Neoliberalism Toxic Managers
(slightly skeptical) Educational society promoting "Back to basics" movement against IT overcomplexity and  bastardization of classic Unix

Perl Mail Processing Scripts

News

 

Perl Recommended Links DNS spam
Milters Pop3 delivery agents Maillists SMS Libraries Scripts for mime processing
Helpdesk -related List servers Decoding Mime Attachments Mutt Humor Etc

Mail processing is one of the most popular use of Perl. Perl scripts have been used to send mail and to  filter incoming mail based on address or content (see spam). Perl scripts have also been written to manage mailing lists.

There is several mail clients written in Perl such as psmailFlailPail, WebTools Pure Perl, fruMailer

MIMEDefang  is a popular MIME email scanner designed to do all kinds of email processing. Apache SpamAssassin  is a popular email filer

You can use Email:MIME to send mail in perl

Sending an email with Perl - learn.perl.org

#!/usr/bin/perl

use strict;

use warnings;

# first, create your message

use Email::MIME;

my $message = Email::MIME->create(

  header_str => [

    From    => '[email protected]',

    To      => '[email protected]',

    Subject => 'Happy birthday!',

  ],

  attributes => {

    encoding => 'quoted-printable',

    charset  => 'ISO-8859-1',

  },

  body_str => "Happy birthday to you!\n",

);

# send the message

use Email::Sender::Simple qw(sendmail);

sendmail($message);

Additional suggestions in case you want to use /sbin/sendmail can be found in Simple CGI Perl script to send form by e-mail

 
  1. $ENV{PATH} = '';
  2. sendmail(
  3. 'Target <[email protected]>',
  4. 'hello world',
  5. 'submitted: ' . Dumper(\%data),
  6. 'Source <[email protected]>');
  7.  
  8. sub sendmail {
  9. my ($tofield, $subject, $text, $fromfield) = @_;
  10. my $mailprog = "/usr/lib/sendmail";
  11.  
  12. open my $ph, '|-', "$mailprog -t -oi" or die $!;
  13. print $ph "To: $tofield\n";
  14. print $ph "From: $fromfield\n";
  15. print $ph "Reply-To: $fromfield\n";
  16. print $ph "Subject: $subject\n";
  17. print $ph "\n";
  18. print $ph "$text";
  19. close $ph;
  20. return ;
  21. }
 

In this part of the script we are using some ancient technique to send e-mail. It only works on Unix/Linux systems that have a working sendmail or equivalent.

The actual sending is enclosed in a subroutine that gets 4 parameters.

 

Inside the subroutine we open a process handle to the sendmail command and hand it some parameters. The process handle ($ph in this case) behaves just like a regular file-handle that was open for writing. You can print to it text that will appear on the standard input of the "other program". In this case the "other program" is the systems sendmail program.

When we call close $ph the e-mail is injected in the regular mail queue of the system and is scheduled to be sent out with all the other messages. This usually means within a few seconds the system will try to deliver your e-mail.

Another Warning

Do not use the above script in an environment where anyone can supply the fields in the e-mail header: To, From, Reply-To, Subject in this case. This can create an open mail relay, that can be used to send spam.

Additing attcmhemt to email is covered in the dollowing Perlmonk post How do I send an email with Perl (including an attachment)

Answer: How do I send an email with Perl (including an attachment)?
contributed by lhoward

There are several ways to send e-mails from perl. My favorite for small jobs like this is Mail::Sendmail. This module is very easy to use:

use Mail::Sendmail;

sendmail(
    From    => '[email protected]',
    To      => '[email protected]',
    Subject => 'some subject',
    Message => "body of the message",
);
[download]

 
If you want to send a file as an attachment, that can be easily done with MIME::Lite.
use MIME::Lite;

my $msg = MIME::Lite->new(
    From    => '[email protected]',
    To      => '[email protected]',
    Cc      => '[email protected], [email protected]',
    Subject => 'A message with 2 parts...',
    Type    => 'multipart/mixed',
);

$msg->attach(
    Type     => 'TEXT',
    Data     => "Here's the GIF file you wanted",
);

$msg->attach(
    Type     => 'image/gif',
    Path     => 'aaa000123.gif',
    Filename => 'logo.gif',
);

$msg->send;

[download]

Answer: How do I send an email with Perl (including an attachment)?
contributed by fongsaiyuk

I use Mail::Sender pretty extensively. Here's a code snippet to get you started for sending an email with an attachment. (We let the user's email client determine the helper application to execute based on the file extension of the filename we attach to the message.)

Mail::Sender lets you customize the MIME stuff, but for simple single files you don't need to do that.

sub send_email
{
    my $sender = new Mail::Sender({
        from => $from_address,
    });
    $sender->OpenMultipart({
        to => $to_email,
        subject => $subject,
    });
    $sender->Body;
    $sender->SendLine( $msg_body );
    $sender->SendFile({
        description => 'Raw Data File',
        encoding => '7BIT',
        file => $tempfile,
    });
    $sender->Close;
}

[download]

 

I really like this module. You should seriously consider installing it if you find that you are doing a lot with emailing attachments. It has saved me tons of time.

Answer: How do I send an email with Perl (including an attachment)?
contributed by electrosphere

sub sendAttachment
{
   my( $from, $to, $subject, $filename, $type, $data ) = @_;

   my $boundary = '==' . time . '==';

   # untaint stuff for mailing
   $ENV{'PATH'} = '/bin:/usr/bin';
   delete @ENV{'IFS', 'CDPATH', 'ENV', 'BASH_ENV'};

   my $msg = new Mail::Send;
   $msg->to($to);
   $msg->add('From',$from);
   $msg->subject($subject);
   $msg->add('Content-Type', qq(multipart/mixed; boundary="$boundary";) );

   my $fh = $msg->open;
   print $fh "--$boundary\n";
   print $fh "Content-Disposition: attachment; filename=$filename;\n";
   print $fh "Content-Type: $type; name=$filename; charset=iso-8859-1;\n";
   print $fh "Content-Transfer-Encoding: 8bit;\n\n";
   print $fh $data;
   print $fh "--$boundary\n";
   $fh->close;

My solution uses Mail::Send and sendmail only:

[download]

Used like so:
sendAttachment(
    '"Me, Here" <[email protected]>',
    '[email protected]',
    'Quarterly Report - Q1 2007',
    'report-q12007.csv',
    'text/csv',
    $data
);

[download]

Answer: How do I send an email with Perl (including an attachment)?
contributed by Anonymous Monk
#!/usr/bin/perl -w

use Getopt::Long;
use IO::File;
use MIME::QuotedPrint;
use MIME::Base64;
use Mail::Sendmail;
use strict;
use warnings;

my $cc;
my $bcc;
GetOptions( 'cc=s' => \$cc, 'bcc=s' => \$bcc, );

my( $from, $to, $subject, $msgbody_file, $attachment_file ) = @ARGV;

my $msgbody = read_file( $msgbody_file );
my $attachment_data = encode_base64( read_file( $attachment_file, 1 ) );

my %mail = (
    To   => $to,
    From => $from,
    Subject => $subject
);

$mail{Cc} = $cc if $cc;
$mail{Bcc} = $bcc if $bcc;

my $boundary = "====" . time . "====";

$mail{'content-type'} = qq(multipart/mixed; boundary="$boundary");

$boundary = '--'.$boundary;

$mail{body} = <<END_OF_BODY;
$boundary
Content-Type: text/plain; charset="iso-8859-1"
Content-Transfer-Encoding: quoted-printable

$msgbody
$boundary
Content-Type: application/octet-stream; name="$attachment_file"
Content-Transfer-Encoding: base64
Content-Disposition: attachment; filename="$attachment_file"

$attachment_data
$boundary--
END_OF_BODY

sendmail(%mail) or die $Mail::Sendmail::error;

print "Sendmail Log says:\n$Mail::Sendmail::log\n";

sub read_file
{
    my( $filename, $binmode ) = @_;
    my $fh = new IO::File;
    $fh->open("< $filename")
        or die "Error opening $filename for reading - $!\n";
    $fh->binmode if $binmode;
    local $/;
    <$fh>
}
[download]

Answer: How do I send an email with Perl (including an attachment)?
contributed by Realbot

See the article The Evolution of Perl Email Handling, by Simon Cozens.

Answer: How do I send an email with Perl (including an attachment)?
contributed by Appy16

You can make use of MIME::Lite Module. It can be used to send single as well as multiple attachments. FOR MULTIPLE ATTACHMENTS :

#!/usr/bin/perl
use MIME::Lite;

$from = 'qwerty\@erweer.com';
$to = 'abcd\@efgh.com';
$Subject = 'Hello';

# Part using which the attachment is sent to an email #
$msg = MIME::Lite->new(
        From     => $from,
        To       => $to,
        Subject  => $Subject,
        Type     => 'multipart/Mixed',
);
$msg->attach(
      Type     => 'Text', 
      Data     => "The attachment contains your file"
);
$msg->attach(
	Type	 => 'Image/gif',
        Path         => "/abcd/M.gif"
);

print "Mail Sent\n";
$msg->send; # send via default

[download]

 
FOR SINGLE ATTACHMENTS :
#!/usr/bin/perl

use MIME::Lite;

$from = 'qwerty\@erweer.com';
$to = 'abcd\@efgh.com';
$Subject = 'Hello';

# Part using which the attachment is sent to an email #
$msg = MIME::Lite->new(
        From     => $from,
        To       => $to,
        Subject  => $Subject,
        Type     => 'Image/gif',
        Path         => "/abcd/M.gif"

);
print "Mail Sent\n";
$msg->send; # send via default

[download]


Top Visited
Switchboard
Latest
Past week
Past month

NEWS CONTENTS

Old News ;-)

[Apr 7, 2008] freshmeat.net Project details for psmail

Psmail is a set of Perl scripts that, when used together, are similar to using an email program. Messages are stored one-per-file in specified directories, and utilities are given to create template new messages (writing headers, etc), reply, read, and list messages with relevant info (i.e. #lines, subject, who from, etc.). As each file is a separate message, you can also write complex commandlines to conditionally handle files. Psmail doesn't handle MIME or multiple POP accounts (yet).

New Architec -- Uploading Files and Sending MIME Mail

Most of us have a junk drawer in our house. You know, the one with the random bits of discarded stuff we hope will come in handy in the future, like the last part of a roll of duct tape, a couple of nuts and washers that for some reason weren't needed when we reassembled the shelves this time, and so on. When something needs to get done, we rummage through the drawer looking for the right part or widget, only to pass the same useless items time after time. But every once in a while we find something that's actually useful and we think, "Yeah, I'm so glad I saved that!"

Using Perl to Read Mail

It's been said that if you work on any program long enough, that program will eventually be able to send electronic mail. It doesn't matter what the original purpose of the program was (if you can still remember)--if you develop it long enough, some day that program will send its first piece of email.

From the vantage point of a systems or network administrator, this means there are lots and lots of programs out there generating mail daily. Mail filters like procmail can help us with this deluge by sorting through the mail stream. But sometimes it is more effective to write sophisticated programs to actually read the mail for us. For example, we might write a program to analyze unsolicted commercial email (spam) or one that keeps long-term statistics based on daily diagnostic email from a server.

Creating, Processing and Sending Mail - The Perl Journal, Spring 1996 by Graham Barr

It's hard to imagine the Internet without electronic mail. E-mail is--usually--nothing more than a piece of text; that's why Perl is an excellent tool for processing it. You can use Perl to generate mail, or to sort it, or to write a mail filter which can automatically reply to messages - handy for those times when you're away and want to let people know.

The examples in this column all use the Mail::Internet package, which started life as a mail filter written in Perl 4. When Perl 5 came along it was made more general so that it could be used for program that needed to process, and not merely filter, e-mail. It's now part of the MailTools distribution, which is available from the CPAN. The MailTools distribution contains several other packages for e-mail related activities, such as Mail::Address (for address parsing), Mail::Mailer and Mail::Send (for sending mail), and Mail::Util (which contains some generic utilities). The perlbug program, which now comes bundled with Perl, is a good example of their use.

There are many different flavors of e-mail - the "Internet standard" is just one type, and it's what this article will focus on. Internet mail is described in RFC-822, accessible from one of the sites in

http://www.yahoo.com/Computers_and_Internet/Standards/RFCs/

Creating Mail

E-mail is made up from two parts: the header, which is a list of structured header lines, and the body, which is the text being sent. They're separated by a blank line - that's "\n\n" to you.

First let's look at creating an object in Perl which can be used to represent an e-mail message. An empty message can be created by calling the constructor of the Mail::Internet class.

#!/usr/bin/perl 

 # Create a new Mail::Internet object,
 # which we'll use to build our message. 

 $mail = Mail::Internet->new();

Now that we have our Mail object, we can begin building the message. First we need to add some header lines, such as:

To: List of recipients 
Cc: List of Carbon Copy recipients 
Bcc: List of Blind Carbon Copy recipients 
Subject: Short description of the message

The Bcc line won't be visible in the received message. (Useful for sending your boss copies!)

Perhaps you've noticed strange lines starting with "X-" in messages you've received. These are user-defined headers; the RFC-822 standard allows for any header you like, as long as it begins with that X-. Here are some commonly used headers:

X-Mailer: The name of the mailer which sent this message 
X-Sun-Charset: The character set used (e.g. US-ASCII ) 
X-Sender: The address of the sender
X-Authentication-Warning: Warnings from some SMTP daemons 

You can also make up your own:

X-Caffeination-Level: High 
X-Spoiler: Rosebud is a sled. 
X-Haiku: Old man seeks doctor/ "I eat SPAM daily," says he/ Angioplasty.

But to build our message we often just need to know three things: who we're sending the message to, who we want to carbon copy, and the subject line.

# Add three fields to the message:
# To:, Cc:, and Subject:

$mail->add(To => '[email protected]', 
              Cc => '[email protected]', 
              Subject => 'Please Read This ...' 
             ); 

And now our header is built - all that's left is to add the message text, with the body() method. The Mail::Internet package stores the text in a array, with each item representing a single line of the text. So assuming that the text has been read into @text, we can place it in the body of the mail object as follows:

# Store @text in the message body.
# The $mail object makes a copy, so later 
# changes to @text won't affect the
# message. 

$mail->body( \@text ); 

or you can use an anonymous array instead:

 

$mail->body( ["Be sure to return", "by midnight", " -Fairy Godmother"] );

 
It's possible that you might not want to use a script to construct e-mail. For example, you might have a preformatted message stored in a file. Or perhaps your script is a filter for messages made available via STDIN.

For these situations, you can use Mail::Internet to read a message from a file descriptor, or from an array:

# To read a message from STDIN 

$mail = Mail::Internet->new( \*STDIN ); 

# To read from STDIN or a file in @ARGV 

$mail = Mail::Internet->new( [ <> ] ); 
Processing Mail

Now that we have our $mail object, we can process it however we wish: for mailing lists, vacation filters, mailftp, replyto, and so on.

As an example of processing mail, let's write a simple vacation filter which sends automated replies to anyone who sends us mail, explaining that we're not available to respond.

First our program needs to read the incoming message and create an empty message for the reply:

#!/usr/bin/perl 

require Mail::Internet; 

# We'll need Mail::Address to extract the 
# return address from the incoming message 

require Mail::Address; 

# Since we're running as a filter, the
# incoming message will be available from
# STDIN: 

$mail = Mail::Internet->new( \*STDIN ); 

# Create an empty Mail::Internet object
# for our reply 

$reply = Mail::Internet->new(); 

Next we need to specify the recipient. There are several different header lines we can look in for a reply address, but for simplicity I'll just use the common ones: From and Reply-To.

# Locate address of sender. The get()
# method returns a header line from the
# message, or undef if it doesn't exist. 

$sender = $mail->get('Reply-To') || 
          $mail->get('From'); 

$sender now contains the return address of the person who sent the original message. This is probably sufficient, but for demonstration purposes we'll use Mail::Address to create a To header that we know to be correct:

# Create a Mail::Address object 
# Mail::Address->parse returns a list of
# objects. We probably want the first. 

$sender = (Mail::Address->parse($sender))[0]; 

$reply->add(To => $sender->format); 
There are two header lines that we ought to add now: Subject and References. For the Subject line we'll simply add "Re:" to the beginning of the original subject, unless it's already there. The References line (an ordered list of previous message IDs) isn't essential, but is often used by "threading" mailers to group related messages together. The Message-Id header field contains a unique ID and is added by your mailer dФmon (e.g. sendmail).
# Extract the Subject from the original 
# message 

$subject = $mail->get('Subject'); 

if ($subject) { 

# Add Re: prefix 
    $subject = 'Re: ' . $subject 
              unless $subject =~ /^\s*Re:/i; 

# Set the Subject line on our new message 

    $reply->add(Subject => $subject); 
} 

# Extract the References and Message-Id from 
# the original message 

$ref = $mail->get('References') || ''; 
$mid = $mail->get('Message-Id'); 

# Combine them to create our new 
# References line 

$ref .= ' ' . $mid if $mid; 
# Add our new References line to our 
# reply message 

$reply->add(References => $ref) 
                       if length $ref; 

Now that our header is built, we'll add a body. I'll just add a hardcoded blob of text, but it could have been read from a file (such as $ENV{HOME}/.vacation).

# Create an array containing reply text 

@reply = ("This is a recorded message", 
          "I am away from my machine at the moment", 
          "and will reply to your message",
          "as soon as I return"); 

# Add the body to the reply message 

$reply->body( \@reply ); 

Now that our message is complete, we just need to send it. This can be done in several ways. If you're on a UNIX system, you can open a pipe to sendmail and print the message through the pipe. For example:

# Open a pipe to /usr/lib/sendmail. -t tells
# sendmail to scan the input for To, Cc, and 
# Bcc headers, and extract the mail addresses. 

open(MAIL, "|/usr/lib/sendmail -t") 
                 || die "Can't send mail: $!"; 

# print the message down the pipe 
# (i.e.: send the message to sendmail)

$reply->print( \*MAIL ); 

close(MAIL);

The message has now been sent (hopefully!).

Obviously, if you don't have sendmail, or an equivalent program, this isn't an option. Then you have to send the message directly to a mailhost machine using the Simple Mail Transfer Protocol (SMTP), defined in RFC821.

SMTP, being a text-based protocol, is easily implemented in Perl. In fact, a Net::SMTP module has already been written. But before using this module, there are a few things you need to know:

require Net::SMTP; 
use Mail::Util qw(mailaddress); 

# Create a Net::SMTP object, which opens 
# an SMTP connection to the mailhost. 
# This sends the SMTP 'HELO' command. 

$smtp = Net::SMTP->new('mailhost'); 

# Tell the SMTP server we want to start to send 
# a piece of mail, use mailaddress() to find 
# our own e-mail address, which will be used
# as a return address.
$smtp->mail( mailaddress() ) 
                       || die $smtp->message; 

# Extract all the recipients from the reply
my @rcpt = ($reply->get('To', 'Cc', 'Bcc')); 

# use Address::parse to parse these addresses,
# returning a list of Mail::Address objects. 
# Then map these, ending up with a list
# of addresses.
my @addr = map($_->address, 
               Mail::Address->parse(@rcpt)); 

# Tell the SMTP server the recipient 
# addresses.

$smtp->to(@addr) || die $smtp->message; 

# Create the message as a single piece of text, 
# ensuring that there's a blank line between 
# the header and the body. 
my $text = join("", @{$reply->header},
                "\n", @{$reply->body}); 

# Send the message to the SMTP server 

$smtp->data( $text ) || die $smtp->message; 
# Tell the SMTP server that we've finished 
# ...and close the connection 

$smtp->quit;

The message has now been sent. Mail::Internet provides a method for doing all of this: smtpsend() sends SMTP messages for you. Mail::Internet also defines a similar method, nntppost(), which (assuming the object has a Newsgroups header) posts the message to your news host using NNTP, the Network News Transfer Protocol.

That example could be split into two scripts, one which generates the reply and one which sends it. The reply script could then be enhanced so that the body is a duplicate of the incoming message indented - ideal as a reply generator. The code to do this could look something like:

# Create a duplicate of the original 
# body text 

$body = [ @{$mail->body} ]; 

# Prefix each line with a > 

grep { s/\A/>/ } @$body; 

# $sender, which was set earlier in the
# script, contains a Mail::Address
# object. From this we may be able to
# extract the senders name. If not,
# default to the senders address.

$name = $sender->name || 
                       $sender->address; 

# Add a one line prefix to the message
# stating who we're quoting 

unshift(@$body, $name . " Wrote:\n"); 

# Set the body text of our reply message 
$reply->body( $body ); 
And we're done!

Many people complain about being flooded with e-mail. For the most part, that's e-mail sent by people. Now that our programs can generate e-mail as well, we can expect the floodgates to widen, right? Possibly - but our programs can filter e-mail too, letting us narrow the floodgates if we wish.

__END__

FetchYahoo

FetchYahoo is a Perl script that downloads mail from a Yahoo! account to a local mail spool. It is meant to replace fetchmail for people using Yahoo! mail since Yahoo!'s POP service is no longer free. It downloads messages to a local mail spool, including all parts and attachments. It then deletes messages unless requested not to. It can also optionally forward messages to a specified email address and repeat with a given interval.

nms

nms is a set of drop-in replacements for the CGI scripts found at Matt's Script Archive. They have been developed from the ground up to emulate their behavior, but in many cases are better written and more secure. The collection includes form mail, guest book, simple search, and counter scripts

kernel-alert

kernel-alert is a perl script meant to be run as a cron, to send e-mail whenever new Linux kernels become available. It also has the ability to attach the new patches to the e-mail.

NS WebMail

NS WebMail offers standard mail functions for POP3 inbox management. Mail is sent using SMTP protocol. It has been designed to be light and simple, to avoid having to use heavy IMAP or SQL servers, and it has full MIME support for incoming and outgoing mail. It is Perl-strict and mod_perl-compliant, and has security using HTTP authentication or cookies. LDAP connectors are also available (as optional plug-ins) for authentication and read-only address book. Two interfaces are available (with and without frames). It is able to recognize tags from spam detection software (Spamassassin is supported out of the box).

COMRAD

COMRAD, the CAIW Open Mail Relay Automatic Detection system, is a suite of Perl scripts that can be used as the basis of an automated open mail relay test system.

MHonArc

MHonArc is a Perl program for converting mail or news messages into HTML archives. It can also be used to convert individual messages into HTML documents. Other capabilities include robust MIME support and powerful user customization features

Flail

Flail is a flexible, lightweight, minimalist mailer with a command-line interface. It is unabashedly designed to make Perl hackers happy. Using flail, it's easy to assemble useful bits of mail-related Perl code into a fairly powerful mail reading and filtering environment with or GUIs or other frills.

fruMailer

FruMailer is a project written in Perl/Tk that aims to be an e-mail client (MUA) with a small, fast, light, and simple GUI interface.

mailidx

mailidx contains a perl script that can read a mailbox in unix mailbox format and store messages in a database. It uses regular expressions to match mail headers to known mail lists. The owner is informed if no list matches are made. A basic PHP front-end is provided to serve as an example.

pemf

pemf is a Perl mail filter that is easy to modify and control. It can save mail, reply to mail, forward mail, pipe mail, forge mail, and do anything else that a Turing complete mail filter should do.

AMaViS "Next Generation"

AMaViS-ng is a modular rewrite of amavisd and amavis-perl. It scans email for malicious code inside attachments and archive files, stopping delivery if malicious code is found. It supports integration of several third-party virus scanners and integrates nicely into several MTA setups. Unlike amavis-perl and amavisd, there is no need for build-time configuration.

Pronto!

Pronto! is a full-featured mail client written in Perl/GTK+, and a continuation of the development of CSCMail project in Perl. It supports multiple POP3/maildir and mbox accounts, imports/exports MBOX, and has full search features and VFolders, sortable filters, threaded message list, a nested folder list, drag and drop, and inbound and outbound attachments.

mailagent - automatic mail processing tool

mailagent uses lex-like rules to match messages and run rich set of commands. Mail can be stored in mailboxes, forwarded, piped through external applications, posted to newsgroups, checked for duplicates, annotated, or deleted. Headers can be pruned and digests burst. Additional commands can be written in Perl.

WebTools Pure Perl

WebTools is "system" of multiple modules and libraries. Along with template engine capabilities, it features session management, global variables support, cookies support, and various database interfaces. It also features a pure Perl mail client, categories management, form checking, and libraries such as a CGI-based downloading library, HTML parsers, and a library that makes PHP functions available to Perl for ease of development.

perl-esmtpd

perl-esmtpd is an antispam, antivirus, and authenticating SMTP daemon. It integrates with qmail, sendmail, stunnel, etc. It's simple Perl, so you can hack it to suit your needs. It supports RBLs, mx on from, bounce evil phrases, virus scanning, etc. It offers: RBL-sytle black-hole DNS checking when not relaying, verification of valid MX records for the MAIL FROM (when not relayin, the ability to use Stunnel for smtps connections and still do RBL checks etc., simple authentication (i.e. PLAIN or LOGIN) for offsite users, and the ability to reject email with certain key phrases. Many other useful features are included.

Clean_Mail

Clean_mail is a series of shell and Perl scripts that help a system administrator maintain mail spool files on a large system. They offer deleting of old mails, backup, deleting of spam, automatic mails to users, etc.

Mail--Verify

Mail::Verify provides a function CheckAddress function for verifying email addresses. First the syntax of the email address is checked, then it verifies that there is at least one valid MX server accepting email for the domain. Using Net::DNS and IO::Socket a list of MX records (or, falling back on a hosts A record) are checked to make sure at least one SMTP server is accepting connections

Perl Mail Grabber

Perl Mail Grabber (PMG) is yet another POP3 email retriever program. It handles multiple users, multiple POP3 maildrops, and provides spam blocking and email routing services.

ExiBomb Mail

ExiBomb is a system designed to monitor email traffic on an Exim-based MTA server. The interface is written in PHP. It reads the mail logs in a tail method and stores all relevant data in a MySQL database.The script reading the logs was developed in Perl.

Milters

Sendmail::Milter

Sendmail::Milter is a Perl extension to sendmail's Mail Filter API. With this module, you can define mail filtering actions in Perl that hook into sendmail 8.11 or higher.

Sendmail--AccessDB

Sendmail::AccessDB provides an API for users of Sendmail::Milter to easily determine if a recipient is a "willing recipient" of spam, or if a particular site has been explicitly whitelisted, so that mail from there is not blocked. It also allows generic lookups.

Pop3 delivery agents

checkmails

Checkmail is a simple mail biff written in Perl. It transparently monitors a single POP3 account, and only bothers you if you have any new mail. Checkmail comes with an easy GUI configuration.

NS WebMail

NS WebMail offers standard mail functions for POP3 inbox management. Mail is sent using SMTP protocol. It has been designed to be light and simple, to avoid having to use heavy IMAP or SQL servers, and it has full MIME support for incoming and outgoing mail. It is Perl-strict and mod_perl-compliant, and has security using HTTP authentication or cookies. LDAP connectors are also available (as optional plug-ins) for authentication and read-only address book. Two interfaces are available (with and without frames). It is able to recognize tags from spam detection software (Spamassassin is supported out of the box).

Poppy

Poppy is a small Perl script that will individually retrieve only the headers of mail messages from a POP3/IMAP server and then allow you to view, save, or delete each. This is especially good for systems with limited resources like limited disk space, slow connectivity, or no GUI. It is also good for managing your mailbox when your normal mail reader is setup not to delete mail off the server or is having problems downloading large emails.

acmemail

acmemail is a multiuser IMAP/POP3 to Web gateway (or webmail program). It reads mail from a mail server and displays it using HTML on a web server. It is written in Perl, has full support for MIME (and mod_perl), is quite pretty, and is GPL'd or distributed under the Perl Artistic License.

NeoMail

NeoMail is a web-based email client written in Perl. It provides access to a machine's local mail spools without requiring a POP3 server to be running, and without giving users shell access. It supports sending and receiving attachments, multiple folders, user themes and preferences, templates for interface generation, quotas, language translations, etc.

Mime processing

stripmime

stripmime is a quick and dirty Perl script to strip user-specified MIME sections out of email messages. stripmime acts as a filter, and can be used with programs like procmail and majordomo to turn MIME-encrusted messages into something that text mail readers can deal with more easily.

getattach.pl

getattach.pl is a Perl script for retrieving email attachments, which is especially useful if you receive many image, video, or audio attachments by email. It works with evolution mboxes and mail spools, and uses the Mail::BOX modules to manage mailboxes.

Maillists

MailSpammer

MailSpammer is a simple mailing list manager for smaller e-mail lists, using procmail and Perl. MailSpammer does not require administrator access, aside from initial setup (creating e-mail aliases), and features subscription, unsubscription, moderation, and archiving. The goal is not to be a majordomo-alike mailing list manager, but instead to provide a lightweight way to handle basic list management tasks.

Helpdesk

Frontdesk

GNA Frontdesk is a groupware application designed for customer support and bug tracking. People e-mail their messages into a threaded central repository which may be accessed via the web. The Frontdesk groupware system is written entirely in Perl and currently runs under any platform that supports perl.

SMS

email2sms

email2sms is a filter written in Perl which converts an e-mail into a form suitable for sending as an SMS message. Its main advantage over the alternatives is that it uses the CPAN module Lingua::EN::Squeeze to compress the text down to as little as 40% of its original size, so you can get much more of your e-mail into the 160 character limit imposed by SMS. It is fully MIME compatible, and has many configurable options, including removal of quoted text. Ideal for use with procmail. A Perl script for sending the output to a typical e-mail to SMS web gateway is included.

Libraries

Dicemail

Dicemail is a Perl library for working with email messages. It provides a set of utilities for writing small, simple mail tools and handles account specifications, abstracts operations for different mail server types (currently only IMAP), abstracts messages, and supports operations on mail defined by Perl code.

MTA

SMTP::Server

SMTP::Server is a complete RFC 821 compliant mail server, written entirely in Perl. It's extremely extensible, and can easily be adapted to do things like SPAM/RBL filtering, and it's portable to all major platforms, including Win32. The SMTP::Server architecture was written to be very flexible, and its true power comes from the ability to extend/customize its functionality with plugin modules, or Perl code.

Recommended Links

Google matched content

Softpanorama Recommended

Top articles

Sites

Helpdesk::Mail

The Helpdesk::Mail System is a Perl application intended to assist Helpdesks and Support Centers in organizing their email communication with their customers. Especially if there is one email address and several people who reply to those emails and answer questions, Helpdesk::Mail can come in handy. It is not just another webmail application; one can assign a "user-id" for an e-mail (e.g. an account number) to track how often one user asks for help. It also has an additional "Knowledge Base" feature: if your customers ask the same questions over and over again, you can save the answer in the Knowledge Base and prefill a reply with this answer by simply typing in some keywords and click on a link. There's also a public interface to the Knowledge Base.

Open WebMail

Open WebMail is a webmail system written with Perl. It is designed to manage very large mail folder files in a memory efficient way. It also provides a range of features to help users migrate smoothly from Microsoft Outlook to Open WebMail. Open WebMail has the following features: multiple languages, multiple iconset/styles, strong MIME support, SMTP relaying, virtual hosting, user aliases, pure virtual user, per user based capability, multiple authentication modules, PAM support, folder/message management, draft folder, confirm reading support, full content search, spellchecking, auto reply, mail filter, webdisk, calendar, event reminder, POP3 support, online password changing, message count preview, user history, and persistant running support.

WebMailFolder

WebMailFolder is a tool to convert Emails to HTML and make index files (author, data, subject, thread). Features include threading, mime support, Base64 and uuencode support, statistics page, extended configuration and frame support.

CaMail

CaMail is a free modular Webmail system that uses mod_perl and Template Toolkit. It supports multiple IMAP/SMTP servers across multiple domains, and addressbooks via LDAP. In addition, LDAP is used to store sessions, contacts, groups, mail filters, and user preferences.



Etc

Society

Groupthink : Two Party System as Polyarchy : Corruption of Regulators : Bureaucracies : Understanding Micromanagers and Control Freaks : Toxic Managers :   Harvard Mafia : Diplomatic Communication : Surviving a Bad Performance Review : Insufficient Retirement Funds as Immanent Problem of Neoliberal Regime : PseudoScience : Who Rules America : Neoliberalism  : The Iron Law of Oligarchy : Libertarian Philosophy

Quotes

War and Peace : Skeptical Finance : John Kenneth Galbraith :Talleyrand : Oscar Wilde : Otto Von Bismarck : Keynes : George Carlin : Skeptics : Propaganda  : SE quotes : Language Design and Programming Quotes : Random IT-related quotesSomerset Maugham : Marcus Aurelius : Kurt Vonnegut : Eric Hoffer : Winston Churchill : Napoleon Bonaparte : Ambrose BierceBernard Shaw : Mark Twain Quotes

Bulletin:

Vol 25, No.12 (December, 2013) Rational Fools vs. Efficient Crooks The efficient markets hypothesis : Political Skeptic Bulletin, 2013 : Unemployment Bulletin, 2010 :  Vol 23, No.10 (October, 2011) An observation about corporate security departments : Slightly Skeptical Euromaydan Chronicles, June 2014 : Greenspan legacy bulletin, 2008 : Vol 25, No.10 (October, 2013) Cryptolocker Trojan (Win32/Crilock.A) : Vol 25, No.08 (August, 2013) Cloud providers as intelligence collection hubs : Financial Humor Bulletin, 2010 : Inequality Bulletin, 2009 : Financial Humor Bulletin, 2008 : Copyleft Problems Bulletin, 2004 : Financial Humor Bulletin, 2011 : Energy Bulletin, 2010 : Malware Protection Bulletin, 2010 : Vol 26, No.1 (January, 2013) Object-Oriented Cult : Political Skeptic Bulletin, 2011 : Vol 23, No.11 (November, 2011) Softpanorama classification of sysadmin horror stories : Vol 25, No.05 (May, 2013) Corporate bullshit as a communication method  : Vol 25, No.06 (June, 2013) A Note on the Relationship of Brooks Law and Conway Law

History:

Fifty glorious years (1950-2000): the triumph of the US computer engineering : Donald Knuth : TAoCP and its Influence of Computer Science : Richard Stallman : Linus Torvalds  : Larry Wall  : John K. Ousterhout : CTSS : Multix OS Unix History : Unix shell history : VI editor : History of pipes concept : Solaris : MS DOSProgramming Languages History : PL/1 : Simula 67 : C : History of GCC developmentScripting Languages : Perl history   : OS History : Mail : DNS : SSH : CPU Instruction Sets : SPARC systems 1987-2006 : Norton Commander : Norton Utilities : Norton Ghost : Frontpage history : Malware Defense History : GNU Screen : OSS early history

Classic books:

The Peter Principle : Parkinson Law : 1984 : The Mythical Man-MonthHow to Solve It by George Polya : The Art of Computer Programming : The Elements of Programming Style : The Unix Hater’s Handbook : The Jargon file : The True Believer : Programming Pearls : The Good Soldier Svejk : The Power Elite

Most popular humor pages:

Manifest of the Softpanorama IT Slacker Society : Ten Commandments of the IT Slackers Society : Computer Humor Collection : BSD Logo Story : The Cuckoo's Egg : IT Slang : C++ Humor : ARE YOU A BBS ADDICT? : The Perl Purity Test : Object oriented programmers of all nations : Financial Humor : Financial Humor Bulletin, 2008 : Financial Humor Bulletin, 2010 : The Most Comprehensive Collection of Editor-related Humor : Programming Language Humor : Goldman Sachs related humor : Greenspan humor : C Humor : Scripting Humor : Real Programmers Humor : Web Humor : GPL-related Humor : OFM Humor : Politically Incorrect Humor : IDS Humor : "Linux Sucks" Humor : Russian Musical Humor : Best Russian Programmer Humor : Microsoft plans to buy Catholic Church : Richard Stallman Related Humor : Admin Humor : Perl-related Humor : Linus Torvalds Related humor : PseudoScience Related Humor : Networking Humor : Shell Humor : Financial Humor Bulletin, 2011 : Financial Humor Bulletin, 2012 : Financial Humor Bulletin, 2013 : Java Humor : Software Engineering Humor : Sun Solaris Related Humor : Education Humor : IBM Humor : Assembler-related Humor : VIM Humor : Computer Viruses Humor : Bright tomorrow is rescheduled to a day after tomorrow : Classic Computer Humor

The Last but not Least Technology is dominated by two types of people: those who understand what they do not manage and those who manage what they do not understand ~Archibald Putt. Ph.D


Copyright © 1996-2021 by Softpanorama Society. www.softpanorama.org was initially created as a service to the (now defunct) UN Sustainable Development Networking Programme (SDNP) without any remuneration. This document is an industrial compilation designed and created exclusively for educational use and is distributed under the Softpanorama Content License. Original materials copyright belong to respective owners. Quotes are made for educational purposes only in compliance with the fair use doctrine.

FAIR USE NOTICE This site contains copyrighted material the use of which has not always been specifically authorized by the copyright owner. We are making such material available to advance understanding of computer science, IT technology, economic, scientific, and social issues. We believe this constitutes a 'fair use' of any such copyrighted material as provided by section 107 of the US Copyright Law according to which such material can be distributed without profit exclusively for research and educational purposes.

This is a Spartan WHYFF (We Help You For Free) site written by people for whom English is not a native language. Grammar and spelling errors should be expected. The site contain some broken links as it develops like a living tree...

You can use PayPal to to buy a cup of coffee for authors of this site

Disclaimer:

The statements, views and opinions presented on this web page are those of the author (or referenced source) and are not endorsed by, nor do they necessarily reflect, the opinions of the Softpanorama society. We do not warrant the correctness of the information provided or its fitness for any purpose. The site uses AdSense so you need to be aware of Google privacy policy. You you do not want to be tracked by Google please disable Javascript for this site. This site is perfectly usable without Javascript.

Last modified: March, 29, 2020