| 1 | 1 | ▶ | use strict; | ||||||||
|
Subroutine
BEGIN: called CC=1 SCAR=0.0
| |||||||||||
| 2 | 1 | ▶ | use warnings; | ||||||||
|
Subroutine
BEGIN: called CC=1 SCAR=0.0
| |||||||||||
| 3 | |||||||||||
| 4 | package App::Addex::Output::Procmail 0.027; | ||||||||||
| 5 | # ABSTRACT: generate procmail recipes from an address book | ||||||||||
| 6 | |||||||||||
| 7 | 1 | ▶ | use parent qw(App::Addex::Output::ToFile); | ||||||||
|
Subroutine
BEGIN: called CC=1 SCAR=0.0
| |||||||||||
| 8 | |||||||||||
| 9 | #pod =head1 DESCRIPTION | ||||||||||
| 10 | #pod | ||||||||||
| 11 | #pod This plugin produces a file that contains a list of procmail recipes. For | ||||||||||
| 12 | #pod any entry with a "folder" field, recipes are produced to deliver all mail from | ||||||||||
| 13 | #pod its addresses to the given folder. | ||||||||||
| 14 | #pod | ||||||||||
| 15 | #pod Forward slashes in the folder name are converted to dots, showing my bias | ||||||||||
| 16 | #pod toward Courier IMAP. | ||||||||||
| 17 | #pod | ||||||||||
| 18 | #pod =head1 CONFIGURATION | ||||||||||
| 19 | #pod | ||||||||||
| 20 | #pod The valid configuration parameters for this plugin are: | ||||||||||
| 21 | #pod | ||||||||||
| 22 | #pod filename - the filename to which to write the procmail recipes | ||||||||||
| 23 | #pod | ||||||||||
| 24 | #pod =method process_entry | ||||||||||
| 25 | #pod | ||||||||||
| 26 | #pod $procmail_outputter->process_entry($addex, $entry); | ||||||||||
| 27 | #pod | ||||||||||
| 28 | #pod This method does the actual writing of configuration to the file. | ||||||||||
| 29 | #pod | ||||||||||
| 30 | #pod =cut | ||||||||||
| 31 | |||||||||||
| 32 | 6 | ▶ | sub process_entry { | ||||||||
|
Subroutine
process_entry: called CC=4 SCAR=13.9
Pod
documented
| |||||||||||
| 33 | 6 | my ($self, $addex, $entry) = @_; | |||||||||
| 34 | |||||||||||
| 35 | 6 | ▶ | return unless my $folder = $entry->field('folder'); | ||||||||
|
Branch: 1 branch
| |||||||||||
| 36 | |||||||||||
| 37 | 3 | $folder =~ tr{/}{.}; | |||||||||
| 38 | |||||||||||
| 39 | 3 | my @emails = $entry->emails; | |||||||||
| 40 | |||||||||||
| 41 | 3 | for my $email (@emails) { | |||||||||
| 42 | 3 | ▶ | next unless $email->sends; | ||||||||
|
Branch: 1 branch
| |||||||||||
| 43 | 3 | $self->output(":0"); | |||||||||
| 44 | 3 | $self->output("* From:.*$email"); | |||||||||
| 45 | 3 | $self->output(".$folder/"); | |||||||||
| 46 | 3 | $self->output(q{}); | |||||||||
| 47 | } | ||||||||||
| 48 | |||||||||||
| 49 | } | ||||||||||
| 50 | |||||||||||
| 51 | 1 | 1; | |||||||||
| 52 | |||||||||||
| 53 | __END__ | ||||||||||