[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]
[coldsync-hackers] PATCH: allow desktop backup for send-mail conduits
Add option Outbox-Backup to allow specify a local file where the
conduits will save the file browsable as an mbox format (aka: m{ail|utt} -f
file)
--- /usr/lib/coldsync/send-mail Sun Jan 13 03:21:09 2002
+++ send-mail Sun Jan 13 04:27:10 2002
@@ -16,13 +16,15 @@
"My-Address" => (getpwuid($>))[0],
"Wrap" => 74,
"Outbox-name" => "Outbox", # Name of category for outgoing mail
-
+ "Outbox-Backup" => "", # Outbox Backup file
"Paragraph" => "", # Paragraph indent
"Line-Indent" => "", # Line indentation
);
my $VERSION = (qw( $Revision: 1.9 $ ))[1]; # Conduit version
+my $backup;
+
# print_header
# Print a valid mail header. Headers with empty values are ignored.
# Newlines are replaced with newline-whitespace, per RFC822.
@@ -39,6 +41,7 @@
$header_content =~ s/\n(?!\s)/\n\t/mg;
print SENDMAIL "$header_name: $header_content\n";
+ print BACKUP "$header_name: $header_content\n" if defined($backup)
}
StartConduit("dump");
@@ -63,6 +66,13 @@
push @sm_args, "-N", "success,failure";
}
+ if (defined($HEADERS{'Outbox-Backup'}))
+ {
+ $backup=1;
+ open BACKUP, ">>$HEADERS{'Outbox-Backup'}" or die "502 Can't open $HEADERS{'Outbox-Backup'}: $!\n";
+ print BACKUP "\n\n" if (-s $HEADERS{'Outbox-Backup'});
+ print BACKUP "From " . (getpwuid($>))[0] . "\@" . $ENV{HOSTNAME} . " " . `date '+%c'`; #date portable?
+ }
open SENDMAIL, "| $HEADERS{Sendmail} @sm_args" or
die "502 Can't run $HEADERS{Sendmail}: $!\n";
select SENDMAIL;
@@ -89,10 +99,10 @@
if $HEADERS{Wrap} > 0;
print "\n", $body;
-
+ print BACKUP "\n", $body if defined($backup);
select STDOUT;
close SENDMAIL;
-
+ close BACKUP if defined($backup);
$PDB->delete_Record($record, 1);
}
@@ -109,12 +119,13 @@
=head1 SYNOPSIS
conduit dump {
- type: mail/DATA;
- path: "<...>/send-mail";
+ type: mail/DATA;
+ path: "<...>/send-mail";
arguments:
- Sendmail: /path/to/sendmail;
- My-Address: user@my.dom.ain;
- Outbox-name: Outbox;
+ Sendmail: /path/to/sendmail;
+ My-Address: user@my.dom.ain;
+ Outbox-name: Outbox;
+ Outbox-Backup: /path/to/backup-file
}
=head1 DESCRIPTION
@@ -150,6 +161,11 @@
Specifies the category where outgoing messages are stored.
If omitted, the default F<Outbox> is used. For German use F<Ausgang>.
+
+=item C<Outbox-Backup>
+
+Specifies the files where the outgoing message are going to be
+backuped on the desktop as an mbox format.
=head1 BUGS
Diff finished at Sun Jan 13 04:27:16
--
This message was sent through the coldsync-hackers mailing list. To remove
yourself from this mailing list, send a message to majordomo@thedotin.net
with the words "unsubscribe coldsync-hackers" in the message body. For more
information on Coldsync, send mail to coldsync-hackers-owner@thedotin.net.