Commit a57e6737 authored by Leigh B Stoller's avatar Leigh B Stoller

More tweaks to email from address.

parent 2ded1b43
#!/usr/bin/perl -wT #!/usr/bin/perl -wT
# #
# Copyright (c) 2005-2013 University of Utah and the Flux Group. # Copyright (c) 2005-2014 University of Utah and the Flux Group.
# #
# {{{EMULAB-LICENSE # {{{EMULAB-LICENSE
# #
...@@ -972,6 +972,7 @@ sub SendApprovalEmail($$$) ...@@ -972,6 +972,7 @@ sub SendApprovalEmail($$$)
my $gid = $self->gid(); my $gid = $self->gid();
my $allleaders = $self->LeaderMailList(); my $allleaders = $self->LeaderMailList();
my $membership = $self->LookupUser($target_user); my $membership = $self->LookupUser($target_user);
my $project = $self->GetProject();
return -1 return -1
if (!defined($membership)); if (!defined($membership));
...@@ -987,7 +988,7 @@ sub SendApprovalEmail($$$) ...@@ -987,7 +988,7 @@ sub SendApprovalEmail($$$)
"\n\n". "\n\n".
"Thanks,\n". "Thanks,\n".
"Testbed Operations\n", "Testbed Operations\n",
undef, $project->ApprovalEmailAddress(),
"CC: $allleaders\n". "CC: $allleaders\n".
"Bcc: $TBAUDIT"); "Bcc: $TBAUDIT");
......
...@@ -144,11 +144,48 @@ sub IsNonLocal($) { return (defined($_[0]->nonlocal_id()) ? 1 : 0); }; ...@@ -144,11 +144,48 @@ sub IsNonLocal($) { return (defined($_[0]->nonlocal_id()) ? 1 : 0); };
sub nonlocal_id($) { return field($_[0], "nonlocal_id"); } sub nonlocal_id($) { return field($_[0], "nonlocal_id"); }
sub nonlocal_type($) { return field($_[0], "nonlocal_type"); } sub nonlocal_type($) { return field($_[0], "nonlocal_type"); }
sub manager_urn($) { return field($_[0], "manager_urn"); } sub manager_urn($) { return field($_[0], "manager_urn"); }
sub genesis($) { return field($_[0], "genesis"); }
sub isAPT($) { return $_[0]->genesis() eq "aptlab" ? 1 : 0; }
sub isCloud($) { return $_[0]->genesis() eq "cloudlab" ? 1 : 0; }
# These come from the group not the project. # These come from the group not the project.
sub unix_gid($) { return $_[0]->{'GROUP'}->unix_gid(); } sub unix_gid($) { return $_[0]->{'GROUP'}->unix_gid(); }
sub unix_name($) { return $_[0]->{'GROUP'}->unix_name(); } sub unix_name($) { return $_[0]->{'GROUP'}->unix_name(); }
# In general, not be used directly, use SendProjAdminMail
sub ApprovalEmailAddress($)
{
my ($self) = @_;
return ($self->isAPT() ? "aptlab-approval\@aptlab.net" :
$self->isCloud() ? "cloudlab-approval\@cloudlab.us" :
"@TBAPPROVALEMAIL@");
}
sub EmailTag($)
{
my ($self) = @_;
return ($self->isAPT() ? "aptlab.net" :
$self->isCloud() ? "cloudlab.us" : "@THISHOMEBASE@");
}
sub wwwBase($)
{
my ($self) = @_;
return ($self->isAPT() ? "https://www.aptlab.net" :
$self->isCloud() ? "https://www.cloudlab.us" : $TBBASE);
}
sub SignupURL($)
{
my ($self) = @_;
my $wwwbase = $self->wwwBase();
my $pid = $self->pid();
return ($self->isAPT() || $self->isCloud() ?
"${wwwbase}/signup.php?pid=$pid" :
"${wwwbase}/joinproject.php3?target_pid=$pid");
}
# #
# Lookup given pid For backwards compat. # Lookup given pid For backwards compat.
# #
...@@ -478,7 +515,7 @@ sub SendNewProjectEmail($;$) ...@@ -478,7 +515,7 @@ sub SendNewProjectEmail($;$)
if ($returning || $firstproject) { if ($returning || $firstproject) {
SendProjAdminMail SendProjAdminMail
($pid, "$usr_name '$usr_uid' <$usr_email>", "ADMIN", ($self, "$usr_name '$usr_uid' <$usr_email>", "ADMIN",
"New Project '$pid' ($usr_uid)", "New Project '$pid' ($usr_uid)",
"'$usr_name' wants to start project '$pid'.\n". "'$usr_name' wants to start project '$pid'.\n".
"\n". "\n".
...@@ -515,7 +552,7 @@ sub SendNewProjectEmail($;$) ...@@ -515,7 +552,7 @@ sub SendNewProjectEmail($;$)
} }
else { else {
SendProjAdminMail SendProjAdminMail
($pid, "$usr_name '$usr_uid' <$usr_email>", "ADMIN", ($self, "$usr_name '$usr_uid' <$usr_email>", "ADMIN",
"New Project '$pid' ($usr_uid)", "New Project '$pid' ($usr_uid)",
"'$usr_name' wants to start project '$pid'.\n". "'$usr_name' wants to start project '$pid'.\n".
"\n". "\n".
......
...@@ -39,9 +39,6 @@ use Exporter; ...@@ -39,9 +39,6 @@ use Exporter;
TBValidUserDir TBValidUserDirList TBMakeTempFile NewUUID System TBValidUserDir TBValidUserDirList TBMakeTempFile NewUUID System
SendProjAdminMail ReOpenLog SendProjAdminMail ReOpenLog
CheckDaemonRunning MarkDaemonRunning MarkDaemonStopped); CheckDaemonRunning MarkDaemonRunning MarkDaemonStopped);
@EXPORT_OK =
qw ( TBMAIL_PROJADMIN);
# After package decl. # After package decl.
use English; use English;
...@@ -51,11 +48,8 @@ use Fcntl; ...@@ -51,11 +48,8 @@ use Fcntl;
use Fcntl ':flock'; use Fcntl ':flock';
use File::Basename; use File::Basename;
use Time::HiRes qw(gettimeofday); use Time::HiRes qw(gettimeofday);
use vars qw(@EXPORT_OK);
my $TB = "@prefix@"; my $TB = "@prefix@";
#my $MAILTAG = "@OURDOMAIN@";
my $MAILTAG = "@THISHOMEBASE@";
my $BOSSNODE = "@BOSSNODE@"; my $BOSSNODE = "@BOSSNODE@";
my $TIMESTAMPS = "@TIMESTAMPS@"; my $TIMESTAMPS = "@TIMESTAMPS@";
my $TBOPSEMAIL = "@TBOPSEMAIL@"; my $TBOPSEMAIL = "@TBOPSEMAIL@";
...@@ -65,6 +59,10 @@ my $UUIDGEN = "@UUIDGEN@"; ...@@ -65,6 +59,10 @@ my $UUIDGEN = "@UUIDGEN@";
my $NOREPLY = "no-reply\@@OURDOMAIN@"; my $NOREPLY = "no-reply\@@OURDOMAIN@";
my $SCRIPTNAME = "Unknown"; my $SCRIPTNAME = "Unknown";
# So we can localize this variable.
use vars qw($MAILTAG);
$MAILTAG = "@THISHOMEBASE@";
# Exported. # Exported.
$SYSTEM_DEBUG = 0; $SYSTEM_DEBUG = 0;
@EXPORT_OK = qw($SYSTEM_DEBUG); @EXPORT_OK = qw($SYSTEM_DEBUG);
...@@ -104,12 +102,6 @@ sub TB_AUDITEMAIL() { $TBAUDITEMAIL; } ...@@ -104,12 +102,6 @@ sub TB_AUDITEMAIL() { $TBAUDITEMAIL; }
sub TBMAIL_OPS() { "Testbed Ops <$TBOPSEMAIL>"; } sub TBMAIL_OPS() { "Testbed Ops <$TBOPSEMAIL>"; }
sub TBMAIL_WWW() { "Testbed WWW <$TBWWWEMAIL>"; } sub TBMAIL_WWW() { "Testbed WWW <$TBWWWEMAIL>"; }
sub TBMAIL_AUDIT() { "Testbed Audit <$TBAUDITEMAIL>" } sub TBMAIL_AUDIT() { "Testbed Audit <$TBAUDITEMAIL>" }
# TBMAIL_PROJADMIN should, in general, not be used directly, use
# SendProjAdminMail
sub TBMAIL_PROJADMIN($) {
0 && @MAILMANSUPPORT@ ? "$_[0]-admin\@@OURDOMAIN@" : "@TBAPPROVALEMAIL@";
}
sub TBMAIL_APPROVAL() { sub TBMAIL_APPROVAL() {
"@TBAPPROVALEMAIL@"; "@TBAPPROVALEMAIL@";
} }
...@@ -237,6 +229,7 @@ sub OPENMAIL($$;$$) ...@@ -237,6 +229,7 @@ sub OPENMAIL($$;$$)
{ {
my($To, $Subject, $From, $Headers) = @_; my($To, $Subject, $From, $Headers) = @_;
local *MAIL; local *MAIL;
my $tag = uc($MAILTAG);
if (! open(MAIL, "|/usr/sbin/sendmail -i -t")) { if (! open(MAIL, "|/usr/sbin/sendmail -i -t")) {
print STDERR "OPENMAIL: Could not start sendmail: $!\n"; print STDERR "OPENMAIL: Could not start sendmail: $!\n";
...@@ -271,8 +264,9 @@ sub OPENMAIL($$;$$) ...@@ -271,8 +264,9 @@ sub OPENMAIL($$;$$)
sub SendProjAdminMail($$$$$;$) sub SendProjAdminMail($$$$$;$)
{ {
my ($proj, $from, $to, $subject, $message, $headers) = @_; my ($project, $from, $to, $subject, $message, $headers) = @_;
my $projadminmail = TBMAIL_PROJADMIN($proj); my $projadminmail = $project->ApprovalEmailAddress();
local $MAILTAG = $project->EmailTag();
$headers .= "\n" if defined $headers; $headers .= "\n" if defined $headers;
if ($from eq 'ADMIN') { if ($from eq 'ADMIN') {
$from = $projadminmail; $from = $projadminmail;
......
#!/usr/bin/perl -wT #!/usr/bin/perl -wT
# #
# Copyright (c) 2000-2011 University of Utah and the Flux Group. # Copyright (c) 2000-2014 University of Utah and the Flux Group.
# #
# {{{EMULAB-LICENSE # {{{EMULAB-LICENSE
# #
...@@ -558,21 +558,22 @@ if (! ($ELABINELAB || $isnonlocal)) { ...@@ -558,21 +558,22 @@ if (! ($ELABINELAB || $isnonlocal)) {
if (!$silent) { if (!$silent) {
my $leader_name = $leader->name(); my $leader_name = $leader->name();
my $leader_email = $leader->email(); my $leader_email = $leader->email();
my $wwwbase = $target_project->wwwBase();
my $signupurl = $target_project->SignupURL();
SendProjAdminMail SendProjAdminMail
($pid, "ADMIN", "$leader_name <$leader_email>", ($target_project, "ADMIN", "$leader_name <$leader_email>",
"Project '$pid' Approval", "Project '$pid' Approval",
"\n". "\n".
"This message is to notify you that your project '$pid'\n". "This message is to notify you that your project '$pid'\n".
"has been approved. We recommend that you save this link so that\n". "has been approved. We recommend that you save this link so that\n".
"you can send it to people you wish to have join your project.\n". "you can send it to people you wish to have join your project.\n".
"Otherwise, tell them to go to ${TBBASE} and join it.\n". "Otherwise, tell them to go to ${wwwbase} and join it.\n".
"\n". "\n".
" ${TBBASE}/joinproject.php3?target_pid=$pid\n". " $signupurl\n".
(defined($message) ? "\n${message}\n" : "") . (defined($message) ? "\n${message}\n" : "") .
"\n". "\n".
"Thanks,\n". "Thanks!\n",
"Testbed Operations\n",
"Bcc: $TBAPPROVAL"); "Bcc: $TBAPPROVAL");
# #
......
...@@ -175,7 +175,6 @@ elseif (strcmp($approval, "moreinfo") == 0) { ...@@ -175,7 +175,6 @@ elseif (strcmp($approval, "moreinfo") == 0) {
SendProjAdminMail SendProjAdminMail
($this_project, "ADMIN", "$headname '$headuid' <$headuid_email>", ($this_project, "ADMIN", "$headname '$headuid' <$headuid_email>",
"Project '$pid' Approval Postponed", "Project '$pid' Approval Postponed",
"\n".
"This message is to notify you that your project application\n". "This message is to notify you that your project application\n".
"for $pid has been postponed until we have more information\n". "for $pid has been postponed until we have more information\n".
"or you take certain actions. You can just reply to this message\n". "or you take certain actions. You can just reply to this message\n".
......
Markdown is supported
0%
or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment