Skip to Content.
Sympa Menu

devel - URLIZE Delivery mode and Outlook

Subject: Developers of Sympa

List archive

Chronological Thread  
  • From: Tilman Mueller-Gerbes <address@concealed>
  • To: address@concealed
  • Subject: URLIZE Delivery mode and Outlook
  • Date: 18 Jun 2002 13:22:28 +0200

Hi,

I am currently using Sympa for a new mailing list server and in the
process I have come across an minor issue.

One of the main features used is URLIZE delivery mode (that is storing
attachments on the server and not distributing to recipients).

Strange thing (indeed ;): M$ Outlook does not support the external-body
MIME type used for delivering the attachments (at least the versions I
tested).

I have (as a quick hack) therefore modified Sympa (List.pm) to not only
add the external-body attachments but also append all generated URLs as
an additional footer.

These footers than get displayed correctly as URLs in Outlook (as it
parses text/plain parts for URLs).

Might this be useful or did I overlook something and this could be done
differently?

Thanks

Tilman

BTW: I really like Sympa for its simplicity but powerful features.
Extending its functionality was straightforward. Keep up the *very* good
work.

Diff attached:
--
Tilman Müller-Gerbes, Kempener Str. 53-55, 50733 Köln
E: address@concealed, T: 0221/1206380
Everything's .. under .. control (Hardware)
--- List.pm 2002/06/18 10:00:22 1.1
+++ List.pm 2002/06/18 10:33:39
@@ -1,5 +1,5 @@
# List.pm - This module includes all list processing functions
-# RCS Identication ; $Revision: 1.1 $ ; $Date: 2002/06/18 10:00:22 $
+# RCS Identication ; $Revision: 1.247 $ ; $Date: 2002/02/27 09:18:40 $
#
# Sympa - SYsteme de Multi-Postage Automatique
# Copyright (c) 1997, 1998, 1999, 2000, 2001 Comite Reseau des Universites
@@ -2034,8 +2034,17 @@
return 0;
}
my $mime_types = &tools::load_mime_types();
+ my @attachments = ();
for (my $i=0 ; $i < $url_msg->parts ; $i++) {
- &_urlize_part ($url_msg->parts ($i), $expl, $dir1, $i,
$mime_types, $name, &Conf::get_robot_conf($robot, 'wwsympa_url')) ;
+ my $url = &_urlize_part ($url_msg->parts ($i), $expl, $dir1, $i,
$mime_types, $name, &Conf::get_robot_conf($robot, 'wwsympa_url')) ;
+ push @attachments, $url if (defined($url) && $url ne ''); # save
attachment URLs
+ }
+ ## Add a text including attachment URLs
+ if ($#attachments >= 0) {
+ my $new_msg = _append_text_part($url_msg,
"\n\nAttachments\n\n".join ("\n", @attachments));
+ if (defined $new_msg) {
+ $url_msg = $new_msg;
+ }
}
## Add a footer
my $new_msg = _add_parts($url_msg, $name,
$self->{'admin'}{'footer_type'});
@@ -2189,6 +2198,45 @@
return $msg;
}

+## Append text to a message
+sub _append_text_part {
+ my ($msg, $text) = @_;
+ do_log('debug3', 'List:_append_text_part(%s, %s)', $msg, $text);
+ my $parser = new MIME::Parser;
+ $parser->output_to_core(1);
+ ## Msg Content-Type
+ my $content_type = $msg->head->get('Content-Type');
+ my (@footer_msg);
+ @footer_msg = split ("\n", $text);
+ foreach my $l (@footer_msg) {
+ $l .= "\r\n";
+ }
+ if (!$content_type or $content_type =~ /^text\/plain/i) {
+ my @body = $msg->bodyhandle->as_lines;
+ $msg->bodyhandle (new MIME::Body::Scalar [@body,@footer_msg] );
+ } elsif ($content_type =~ /^multipart\/mixed/i) {
+ ## Append to first part if text/plain
+ if ($msg->parts(0)->head->get('Content-Type') =~ /^text\/plain/i) {
+ my $part = $msg->parts(0);
+ my @body = $part->bodyhandle->as_lines;
+ $part->bodyhandle (new MIME::Body::Scalar [@body,@footer_msg] );
+ } else {
+ &do_log('notice', 'First part of message not in text/plain ; ignoring
appended text');
+ }
+ } elsif ($content_type =~ /^multipart\/alternative/i) {
+ ## Append to first text/plain part
+ foreach my $part ($msg->parts) {
+ &do_log('debug3', 'TYPE: %s', $part->head->get('Content-Type'));
+ if ($part->head->get('Content-Type') =~ /^text\/plain/i) {
+ my @body = $part->bodyhandle->as_lines;
+ $part->bodyhandle (new MIME::Body::Scalar [@body,@footer_msg] );
+ next;
+ }
+ }
+ }
+ return $msg;
+}
+
## Send a digest message to the subscribers with reception digest or summary
sub send_msg_digest {
my ($self,$robot) = @_;
@@ -6797,6 +6845,8 @@
## Delete files created twice or more (with Content-Type.name and
Content-Disposition.filename)
$message->purge ;

+ my $url = undef;
+
if ($i !=0) {
## add the content type /external body
## and the phantom body with content-type
@@ -6811,12 +6861,14 @@
# it seems that the 'name=' option doesn't work
# if the file name has got an extension like '.xxx'-> '.' is replaced
with '_'
(my $file_name = $filename) =~ s/\./\_/g;
+ $url = "$wwsympa_url/attach/$list$dir/$filename";
$head->add('Content-type', "message/external-body; access-type=URL;
URL=$wwsympa_url/attach/$list$dir/$filename; name=\"$file_name\";
size=\"$size\"");

$message->parts([]);
$message->bodyhandle (new MIME::Body::Scalar "$body" );

}
+ return $url;
}

sub store_susbscription_request {

Attachment: signature.asc
Description: Dies ist ein digital signierter Nachrichtenteil




Archive powered by MHonArc 2.6.19+.

Top of Page