App::Addex::Output::Procmail - generate procmail recipes from an address book


App-Addex documentation Contained in the App-Addex distribution.

Index


Code Index:

NAME

Top

App::Addex::Output::Procmail - generate procmail recipes from an address book

VERSION

Top

version 0.022

DESCRIPTION

Top

This plugin produces a file that contains a list of procmail recipes. For any entry with a "folder" field, recipes are produced to deliver all mail from its addresses to the given folder.

Forward slashes in the folder name are converted to dots, showing my bias toward Courier IMAP.

CONFIGURATION

Top

The valid configuration parameters for this plugin are:

  filename - the filename to which to write the procmail recipes

METHODS

Top

App::Addex::Output::Procmail is a App::Addex::Output::ToFile subclass, and inherits its methods.

process_entry

  $procmail_outputter->process_entry($addex, $entry);

This method does the actual writing of configuration to the file.

AUTHOR

Top

Ricardo SIGNES, <rjbs@cpan.org>

BUGS

Top

Please report any bugs or feature requests through the web interface at http://rt.cpan.org. I will be notified, and then you'll automatically be notified of progress on your bug as I make changes.

COPYRIGHT

Top


App-Addex documentation Contained in the App-Addex distribution.
#!/usr/bin/perl
use strict;
use warnings;

package App::Addex::Output::Procmail;
use base qw(App::Addex::Output::ToFile);

our $VERSION = '0.022';

sub process_entry {
  my ($self, $addex, $entry) = @_;

  return unless my $folder = $entry->field('folder');

  $folder =~ tr{/}{.};

  my @emails = $entry->emails;

  for my $email (@emails) {
    next unless $email->sends;
    $self->output(":0");
    $self->output("* From:.*$email");
    $self->output(".$folder/");
    $self->output(q{});
  }

}

1;