From 1171d11891aaaf2e54924564e3dc8af67a5d8569 Mon Sep 17 00:00:00 2001 From: JT Smith Date: Mon, 24 Jul 2006 19:15:35 +0000 Subject: [PATCH] - Deleted a template that was accidentally added to the core. - Made some improvements to the mail subsystems. --- docs/changelog/7.x.x.txt | 2 ++ docs/upgrades/upgrade_7.0.2-7.0.3.pl | 18 +++++++------- lib/WebGUI/Asset/Post.pm | 36 +++++++++++++++++++++------- lib/WebGUI/Mail/Get.pm | 3 ++- lib/WebGUI/Mail/Send.pm | 10 ++++++-- 5 files changed, 49 insertions(+), 20 deletions(-) diff --git a/docs/changelog/7.x.x.txt b/docs/changelog/7.x.x.txt index 183fb4161..23b6fc524 100644 --- a/docs/changelog/7.x.x.txt +++ b/docs/changelog/7.x.x.txt @@ -21,6 +21,8 @@ doesn't work. - Fixed a cross-Matrix linking problem when you have two or more Matricies on one site with the same category names. + - Deleted a template that was accidentally added to the core. + - Made some improvements to the mail subsystems. - fix: Revised WebGUI::HTML::filter "all" so that text does not run together when tags are removed. Added additional tests to HTML.t. (Eric Kennedy) diff --git a/docs/upgrades/upgrade_7.0.2-7.0.3.pl b/docs/upgrades/upgrade_7.0.2-7.0.3.pl index 9d79ce67d..fb239c8ae 100644 --- a/docs/upgrades/upgrade_7.0.2-7.0.3.pl +++ b/docs/upgrades/upgrade_7.0.2-7.0.3.pl @@ -18,20 +18,22 @@ my $toVersion = "7.0.3"; # make this match what version you're going to my $quiet; # this line required -sleep(1); # to prevent duplicate timestamps +sleep(1); # todd prevent duplicate timestamps my $session = start(); # this line required -# upgrade functions go here +deleteTemplate(); finish($session); # this line required -##------------------------------------------------- -#sub exampleFunction { -# my $session = shift; -# print "\tWe're doing some stuff here that you should know about.\n" unless ($quiet); -# # and here's our code -#} +#------------------------------------------------- +sub deleteTemplate { + print "\tDeleting a template that was accidentally added.\n" unless ($quiet); + my $template = WebGUI::Asset->newByDynamicClass($session, "wCIc38CvNHUK7aY92Ww4SQ"); + if (defined $template) { + $template->purge; + } +} diff --git a/lib/WebGUI/Asset/Post.pm b/lib/WebGUI/Asset/Post.pm index baa00537b..fd1c76e68 100644 --- a/lib/WebGUI/Asset/Post.pm +++ b/lib/WebGUI/Asset/Post.pm @@ -638,10 +638,16 @@ sub notifySubscribers { my $message = $self->processTemplate($var, $cs->get("notificationTemplateId")); my $unsubscribe = '

'.$i18n->get("unsubscribe","Asset_Collaboration").'

'; my $user = WebGUI::User->new($self->session, $self->get("ownerUserId")); - my $from = $user->profileField("email") || $cs->get("mailAddress"); - my $replyTo = $cs->get("mailAddress"); my $setting = $self->session->setting; - my $listId = $cs->get("mailAddress"); + my $returnAddress = $setting->get("mailReturnPath"); + my $companyAddress = $setting->get("companyEmail"); + my $listAddress = $cs->get("mailAddress"); + my $posterAddress = $user->profileField("email"); + my $from = $posterAddress || $listAddress || $companyAddress; + my $replyTo = $listAddress || $returnAddress || $companyAddress; + my $sender = $listAddress || $companyAddress || $posterAddress; + my $returnPath = $returnAddress || $sender; + my $listId = $sender; $listId =~ s/\@/\./; my $domain = $cs->get("mailAddress"); $domain =~ s/.*\@(.*)/$1/; @@ -653,6 +659,7 @@ sub notifySubscribers { my $subject = $cs->get("mailPrefix").$self->get("title"); my $mail = WebGUI::Mail::Send->create($self->session, { from=>"<".$from.">", + returnPath => "<".$returnPath.">", replyTo=>"<".$replyTo.">", toGroup=>$cs->get("subscriptionGroupId"), subject=>$subject, @@ -663,11 +670,16 @@ sub notifySubscribers { $mail->addHeaderField("References", "<".$replyId.">"); } $mail->addHeaderField("List-ID", $cs->getTitle." <".$listId.">"); - $mail->addHeaderField("List-Help", "get("companyEmail").">, <".$setting->get("companyURL").">"); + $mail->addHeaderField("List-Help", ", <".$setting->get("companyURL").">"); $mail->addHeaderField("List-Unsubscribe", "<".$siteurl.$cs->getUnsubscribeUrl.">"); $mail->addHeaderField("List-Subscribe", "<".$siteurl.$cs->getSubscribeUrl.">"); - $mail->addHeaderField("List-Owner", "get("companyEmail").">, <".$setting->get("companyURL")."> (".$setting->get("companyName").")"); - $mail->addHeaderField("List-Post", "get("mailAddress").">"); + $mail->addHeaderField("List-Owner", ", <".$setting->get("companyURL")."> (".$setting->get("companyName").")"); + $mail->addHeaderField("Sender", "<".$sender.">"); + if ($listAddress eq "") { + $mail->addHeaderField("List-Post", "No"); + } else { + $mail->addHeaderField("List-Post", ""); + } $mail->addHeaderField("List-Archive", "<".$siteurl.$cs->getUrl.">"); $mail->addHeaderField("X-Unsubscribe-Web", "<".$siteurl.$cs->getUnsubscribeUrl.">"); $mail->addHeaderField("X-Subscribe-Web", "<".$siteurl.$cs->getSubscribeUrl.">"); @@ -677,6 +689,7 @@ sub notifySubscribers { $mail->queue; my $mail = WebGUI::Mail::Send->create($self->session, { from=>"<".$from.">", + returnPath => "<".$returnPath.">", replyTo=>"<".$replyTo.">", toGroup=>$thread->get("subscriptionGroupId"), subject=>$subject, @@ -688,11 +701,16 @@ sub notifySubscribers { $mail->addHeaderField("References", "<".$replyId.">"); } $mail->addHeaderField("List-ID", $cs->getTitle." <".$listId.">"); - $mail->addHeaderField("List-Help", "get("companyEmail").">, <".$setting->get("companyURL").">"); + $mail->addHeaderField("List-Help", ", <".$setting->get("companyURL").">"); $mail->addHeaderField("List-Unsubscribe", "<".$siteurl.$thread->getUnsubscribeUrl.">"); $mail->addHeaderField("List-Subscribe", "<".$siteurl.$thread->getSubscribeUrl.">"); - $mail->addHeaderField("List-Owner", "get("companyEmail").">, <".$setting->get("companyURL")."> (".$setting->get("companyName").")"); - $mail->addHeaderField("List-Post", "get("mailAddress").">"); + $mail->addHeaderField("List-Owner", ", <".$setting->get("companyURL")."> (".$setting->get("companyName").")"); + if ($listAddress eq "") { + $mail->addHeaderField("List-Post", "No"); + } else { + $mail->addHeaderField("List-Post", ""); + } + $mail->addHeaderField("Sender", "<".$sender.">"); $mail->addHeaderField("List-Archive", "<".$siteurl.$cs->getUrl.">"); $mail->addHeaderField("X-Unsubscribe-Web", "<".$siteurl.$thread->getUnsubscribeUrl.">"); $mail->addHeaderField("X-Subscribe-Web", "<".$siteurl.$thread->getSubscribeUrl.">"); diff --git a/lib/WebGUI/Mail/Get.pm b/lib/WebGUI/Mail/Get.pm index 692a1520b..99a4d14df 100644 --- a/lib/WebGUI/Mail/Get.pm +++ b/lib/WebGUI/Mail/Get.pm @@ -44,7 +44,7 @@ These methods are available from this class: #------------------------------------------------------------------- -=head2 connect ( sessionh, params ) +=head2 connect ( session, params ) Constructor. Opens a connection to a POP3 server. @@ -191,6 +191,7 @@ sub getNextMessage { subject => $subject, inReplyTo => $inReplyTo, messageId => $messageId, + "Return-Path" => $returnPath, date => $self->session->datetime->mailToEpoch($head->get("Date")), ); my @segments = (); diff --git a/lib/WebGUI/Mail/Send.pm b/lib/WebGUI/Mail/Send.pm index d0fd66798..0859322df 100644 --- a/lib/WebGUI/Mail/Send.pm +++ b/lib/WebGUI/Mail/Send.pm @@ -209,6 +209,10 @@ A single email address that this message will originate from. Defaults to the co A single email address that responses to this message will be sent to. +=head4 returnPath + +The email address to send bounces to. + =head4 contentType A mime type for the message. Defaults to "multipart/mixed". @@ -248,7 +252,9 @@ sub create { unless ($id =~ m/\@/) { $id .= '@'.$domain; } + my $returnPath = $headers->{returnPath} || $session->setting->get("mailReturnPath") || $from; my $message = MIME::Entity->build( + "Return-Path"=>$returnPath, Type=>$type, From=>$from, To=>$headers->{to}, @@ -261,8 +267,8 @@ sub create { Date=>$session->datetime->epochToMail, "X-Mailer"=>"WebGUI" ); - $message->head->delete("Return-Path"); - $message->head->add("Return-Path", "<". ($session->setting->get("mailReturnPath") || $from) . ">"); +# $message->head->delete("Return-Path"); +# $message->head->add("Return-Path", "<". ($session->setting->get("mailReturnPath") || $from) . ">"); $type = $headers->{contentType}; if ($session->config->get("emailOverride")) { my $to = $headers->{to};