Commit 59113e70 authored by mac's avatar mac

Improved email message headers, to and from fields, and a bit of content.

Also added a copy of the experiment creation message to the user as well as
testbed-www.
parent 96715576
......@@ -48,7 +48,7 @@ $headuid = $row[0];
# If the status is "active", we leave it alone.
#
$query_result = mysql_db_query($TBDBNAME,
"SELECT status,usr_email from users where uid='$headuid'");
"SELECT status,usr_email,usr_name from users where uid='$headuid'");
if (! $query_result) {
TBERROR("Database Error restrieving user status for $headuid", 1);
}
......@@ -58,6 +58,7 @@ if (mysql_num_rows($query_result) == 0) {
$row = mysql_fetch_row($query_result);
$curstatus = $row[0];
$headuid_email = $row[1];
$headname = $row[2];
#echo "Status = $curstatus, Email = $headuid_email<br>\n";
#
......@@ -84,12 +85,12 @@ if (strcmp($approval, "postpone") == 0) {
</h3>\n";
}
elseif (strcmp($approval, "moreinfo") == 0) {
mail("$headuid_email",
"TESTBED: Project Approval Postponed",
mail("$headname '$headuid' <$headuid_email>",
"TESTBED: 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".
"You can just reply to this message to provide more information\n".
"for $pid has been postponed until we have more information.\n".
"You can just reply to this message to provide more information.\n".
"\n$message".
"\n\n".
"Thanks,\n".
......@@ -125,11 +126,11 @@ elseif ((strcmp($approval, "deny") == 0) ||
1);
}
mail("$headuid_email",
"TESTBED: Project Denied",
mail("$headname '$headuid' <$headuid_email>",
"TESTBED: Project '$pid' Denied",
"\n".
"This message is to notify you that your project application\n".
"for $pid has been denied\n".
"for $pid has been denied.\n".
"\n$message".
"\n\n".
"Thanks,\n".
......@@ -152,11 +153,11 @@ elseif ((strcmp($approval, "deny") == 0) ||
1);
}
mail("$headuid_email",
"TESTBED: Account Terminated",
mail("$headname '$headuid' <$headuid_email>",
"TESTBED: Account '$headuid' Terminated",
"\n".
"This message is to notify you that your account has been \n".
"terminated because your project $pid was denied\n".
"terminated because your project $pid was denied.\n".
"\n\n".
"Thanks,\n".
"Testbed Ops\n".
......@@ -238,8 +239,8 @@ elseif (strcmp($approval, "approve") == 0) {
}
}
mail("$headuid_email",
"TESTBED: Project Approval",
mail("$headname '$headuid' <$headuid_email>",
"TESTBED: Project '$pid' Approval",
"\n".
"This message is to notify you that your project $pid\n".
"has been approved.\n".
......
......@@ -72,7 +72,7 @@ while (list ($header, $value) = each ($HTTP_POST_VARS)) {
# If the status is "active", we leave it alone.
#
$query_result = mysql_db_query($TBDBNAME,
"SELECT status,usr_email from users where uid='$user'");
"SELECT status,usr_email,usr_name from users where uid='$user'");
if (! $query_result) {
TBERROR("Database Error restrieving user status for $user", 1);
}
......@@ -82,6 +82,7 @@ while (list ($header, $value) = each ($HTTP_POST_VARS)) {
$row = mysql_fetch_row($query_result);
$curstatus = $row[0];
$user_email = $row[1];
$user_name = $row[2];
#echo "Status = $curstatus, Email = $user_email<br>\n";
#
......@@ -142,8 +143,8 @@ while (list ($header, $value) = each ($HTTP_POST_VARS)) {
TBERROR("Database Error removing $user from project membership ".
"after being denied.", 1);
}
mail("$user_email",
"TESTBED: Project Membership Denied",
mail("$user_name '$user' <$user_email>",
"TESTBED: Project '$project' Membership Denied",
"\n".
"This message is to notify you that you have been denied\n".
"membership in project $project\n".
......@@ -210,8 +211,8 @@ while (list ($header, $value) = each ($HTTP_POST_VARS)) {
}
}
mail("$user_email",
"TESTBED: Project Membership Approval",
mail("$user_name '$user' <$user_email>",
"TESTBED: Project '$project' Membership Approval",
"\n".
"This message is to notify you that you have been approved\n".
"as a member of project $project with $newtrust permissions.\n".
......
......@@ -110,6 +110,17 @@ if (($row = mysql_fetch_row($query_result)) == 0) {
}
$gid = $row[0];
#
# We need the user's name and email.
#
$query_result = mysql_db_query($TBDBNAME,
"SELECT usr_name,usr_email from users where uid=\"$uid\"");
if (($row = mysql_fetch_row($query_result)) == 0) {
TBERROR("Database Error: Getting GID for project $exp_pid.", 1);
}
$user_name = $row[0];
$user_email = $row[1];
#
# At this point enter the exp_id into the database so that it shows up as
# valid when the tb scripts run. We need to remove the entry if any of
......@@ -151,7 +162,8 @@ if ($nonsfile) {
</h2>\n";
if (1) {
mail($TBMAIL_WWW, "TESTBED: New Experiment Created",
mail("$user_name '$uid' <$user_email>",
"TESTBED: '$exp_pid' '$exp_id' New Experiment Created",
"User: $uid\n".
"EID: $exp_id\n".
"PID: $exp_pid\n".
......@@ -161,6 +173,7 @@ if ($nonsfile) {
"Start: $exp_start\n".
"End: $exp_end\n",
"From: $TBMAIL_WWW\n".
"Cc: $TBMAIL_WWW\n".
"Errors-To: $TBMAIL_WWW");
}
echo "</body>
......@@ -288,12 +301,13 @@ echo "</XMP>\n";
# Lets generate a mail message for now so that we can see whats happening.
#
if (1) {
mail($TBMAIL_WWW, "TESTBED: New Experiment Created",
mail("$user_name '$uid' <$user_email>",
"TESTBED: '$exp_pid' '$exp_id' New Experiment Created",
"User: $uid\n".
"EID: $exp_id\n".
"PID: $exp_pid\n".
"Name: $exp_name\n".
"Created: $exp_created\n".
"Created: $exp_created\n".
"Expires: $exp_expires\n".
"Start: $exp_start\n".
"End: $exp_end\n".
......@@ -301,6 +315,7 @@ mail($TBMAIL_WWW, "TESTBED: New Experiment Created",
"Summary:\n\n".
"$summary\n",
"From: $TBMAIL_WWW\n".
"Cc: $TBMAIL_WWW\n".
"Errors-To: $TBMAIL_WWW");
}
......
......@@ -179,7 +179,7 @@ if (! $returning) {
}
$key = GENKEY($proj_head_uid);
mail("$usr_email", "TESTBED: Your New User Key",
mail("$usr_name '$proj_head_uid' <$usr_email>", "TESTBED: Your New User Key",
"\n".
"Dear $usr_name:\n\n".
" Here is your key to verify your account on the ".
......@@ -239,7 +239,7 @@ $unix_gid = $row[0];
# The mail message to the approval list.
#
mail($TBMAIL_APPROVAL,
"TESTBED: New Project", "'$usr_name' wants to start project '$pid'.\n".
"TESTBED: New Project '$pid' ($proj_head_uid)", "'$usr_name' wants to start project '$pid'.\n".
"Contact Info:\n".
"Name: $usr_name ($proj_head_uid)\n".
"Email: $usr_email\n".
......@@ -260,7 +260,7 @@ mail($TBMAIL_APPROVAL,
"made a decision, go to $TBWWW and\n".
"select the 'Project Approval' page.\n\nThey are expecting a result ".
"within 72 hours.\n",
"From: $usr_name <$usr_email>\n".
"From: $usr_name '$proj_head_uid' <$usr_email>\n".
"Cc: $TBMAIL_CONTROL\n".
"Errors-To: $TBMAIL_WWW");
......
......@@ -140,9 +140,9 @@ if (! $returning) {
$key = GENKEY($uid);
mail("$usr_email", "TESTBED: Your New User Key",
mail("$usr_name '$uid' <$usr_email>", "TESTBED: Your New User Key",
"\n".
"Dear $usr_name:\n\n".
"Dear $usr_name ($uid):\n\n".
"\tHere is your key to verify your account on the ".
"Utah Network Testbed:\n\n".
"\t\t$key\n\n".
......@@ -213,19 +213,20 @@ if (($row = mysql_fetch_row($query_result)) == 0) {
TBERROR("Database Error getting project leader for project $pid: $err\n",
1);
}
$project_leader_uid = $row[0];
$leader_uid = $row[0];
$query_result = mysql_db_query($TBDBNAME,
"SELECT usr_email FROM users WHERE uid='$project_leader_uid'");
"SELECT usr_name,usr_email FROM users WHERE uid='$leader_uid'");
if (($row = mysql_fetch_row($query_result)) == 0) {
$err = mysql_error();
TBERROR("Database Error getting email address for project leader ".
"$project_leader_uid: $err\n", 1);
"$leader_uid: $err\n", 1);
}
$project_leader_email = $row[0];
$leader_name = $row[0];
$leader_email = $row[1];
mail("$project_leader_email",
"TESTBED: New Project Member",
mail("$leader_name '$leader_uid' <$leader_email>",
"TESTBED: $uid $pid Project Join Request",
"\n$usr_name ($uid) is trying to join your project ($pid).\n".
"$usr_name has the\n".
"Testbed username $uid and email address $usr_email.\n$usr_name's ".
......
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