Commit a57e6737 authored by Leigh Stoller's avatar Leigh Stoller

More tweaks to email from address.

parent 2ded1b43
#!/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
#
......@@ -972,6 +972,7 @@ sub SendApprovalEmail($$$)
my $gid = $self->gid();
my $allleaders = $self->LeaderMailList();
my $membership = $self->LookupUser($target_user);
my $project = $self->GetProject();
return -1
if (!defined($membership));
......@@ -987,7 +988,7 @@ sub SendApprovalEmail($$$)
"\n\n".
"Thanks,\n".
"Testbed Operations\n",
undef,
$project->ApprovalEmailAddress(),
"CC: $allleaders\n".
"Bcc: $TBAUDIT");
......
......@@ -144,11 +144,48 @@ sub IsNonLocal($) { return (defined($_[0]->nonlocal_id()) ? 1 : 0); };
sub nonlocal_id($) { return field($_[0], "nonlocal_id"); }
sub nonlocal_type($) { return field($_[0], "nonlocal_type"); }
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.
sub unix_gid($) { return $_[0]->{'GROUP'}->unix_gid(); }
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.
#
......@@ -478,7 +515,7 @@ sub SendNewProjectEmail($;$)
if ($returning || $firstproject) {
SendProjAdminMail
($pid, "$usr_name '$usr_uid' <$usr_email>", "ADMIN",
($self, "$usr_name '$usr_uid' <$usr_email>", "ADMIN",
"New Project '$pid' ($usr_uid)",
"'$usr_name' wants to start project '$pid'.\n".
"\n".
......@@ -515,7 +552,7 @@ sub SendNewProjectEmail($;$)
}
else {
SendProjAdminMail
($pid, "$usr_name '$usr_uid' <$usr_email>", "ADMIN",
($self, "$usr_name '$usr_uid' <$usr_email>", "ADMIN",
"New Project '$pid' ($usr_uid)",
"'$usr_name' wants to start project '$pid'.\n".
"\n".
......
......@@ -39,9 +39,6 @@ use Exporter;
TBValidUserDir TBValidUserDirList TBMakeTempFile NewUUID System
SendProjAdminMail ReOpenLog
CheckDaemonRunning MarkDaemonRunning MarkDaemonStopped);
@EXPORT_OK =
qw ( TBMAIL_PROJADMIN);
# After package decl.
use English;
......@@ -51,11 +48,8 @@ use Fcntl;
use Fcntl ':flock';
use File::Basename;
use Time::HiRes qw(gettimeofday);
use vars qw(@EXPORT_OK);
my $TB = "@prefix@";
#my $MAILTAG = "@OURDOMAIN@";
my $MAILTAG = "@THISHOMEBASE@";
my $BOSSNODE = "@BOSSNODE@";
my $TIMESTAMPS = "@TIMESTAMPS@";
my $TBOPSEMAIL = "@TBOPSEMAIL@";
......@@ -65,6 +59,10 @@ my $UUIDGEN = "@UUIDGEN@";
my $NOREPLY = "no-reply\@@OURDOMAIN@";
my $SCRIPTNAME = "Unknown";
# So we can localize this variable.
use vars qw($MAILTAG);
$MAILTAG = "@THISHOMEBASE@";
# Exported.
$SYSTEM_DEBUG = 0;
@EXPORT_OK = qw($SYSTEM_DEBUG);
......@@ -104,12 +102,6 @@ sub TB_AUDITEMAIL() { $TBAUDITEMAIL; }
sub TBMAIL_OPS() { "Testbed Ops <$TBOPSEMAIL>"; }
sub TBMAIL_WWW() { "Testbed WWW <$TBWWWEMAIL>"; }
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() {
"@TBAPPROVALEMAIL@";
}
......@@ -237,6 +229,7 @@ sub OPENMAIL($$;$$)
{
my($To, $Subject, $From, $Headers) = @_;
local *MAIL;
my $tag = uc($MAILTAG);
if (! open(MAIL, "|/usr/sbin/sendmail -i -t")) {
print STDERR "OPENMAIL: Could not start sendmail: $!\n";
......@@ -271,8 +264,9 @@ sub OPENMAIL($$;$$)
sub SendProjAdminMail($$$$$;$)
{
my ($proj, $from, $to, $subject, $message, $headers) = @_;
my $projadminmail = TBMAIL_PROJADMIN($proj);
my ($project, $from, $to, $subject, $message, $headers) = @_;
my $projadminmail = $project->ApprovalEmailAddress();
local $MAILTAG = $project->EmailTag();
$headers .= "\n" if defined $headers;
if ($from eq 'ADMIN') {
$from = $projadminmail;
......
#!/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
#
......@@ -558,21 +558,22 @@ if (! ($ELABINELAB || $isnonlocal)) {
if (!$silent) {
my $leader_name = $leader->name();
my $leader_email = $leader->email();
my $wwwbase = $target_project->wwwBase();
my $signupurl = $target_project->SignupURL();
SendProjAdminMail
($pid, "ADMIN", "$leader_name <$leader_email>",
($target_project, "ADMIN", "$leader_name <$leader_email>",
"Project '$pid' Approval",
"\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".
"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".
" ${TBBASE}/joinproject.php3?target_pid=$pid\n".
" $signupurl\n".
(defined($message) ? "\n${message}\n" : "") .
"\n".
"Thanks,\n".
"Testbed Operations\n",
"Thanks!\n",
"Bcc: $TBAPPROVAL");
#
......
......@@ -175,7 +175,6 @@ elseif (strcmp($approval, "moreinfo") == 0) {
SendProjAdminMail
($this_project, "ADMIN", "$headname '$headuid' <$headuid_email>",
"Project '$pid' Approval Postponed",
"\n".
"This message is to notify you that your project application\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".
......
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