function absenceEmail($recipient, $state, $event)
{
    global $CHOIR;
    $to = prefNameFromEmail($recipient) . " " . lastNameFromEmail($recipient) . " <" . $recipient . ">";
    //make it format: Chris Ernst <*****@*****.**>
    $subject = "Absence Request " . ucfirst($state);
    $msg = prefNameFromEmail($recipient) . ",<br><br> Your absence request for " . $event . " has been " . $state . ".";
    $message = '
	<html>
	<head>
		<style>
			.container{
				font-family:"lucida grande",tahoma,verdana,arial,sans-serif;
				height:100%;
				padding:5px;
				margin-bottom:3px;
			}
			body{
				background:rgb(179,179,179);
			}
			h1{
				width:100%;
				margin:auto;
				text-align:center;
			text-decoration:underline;
				margin-bottom:3px;
			)}
			.from{
				width:100%;
				margin:auto;
				text-align:center;
			}
			.message{
				border-radius:2px;
				background-color:rgba(255,255,255, .7);
				padding:5px;
				border:1px solid rgba(0, 0, 0, 0.1);
				box-shadow:0 4px 7px rgba(0,0,0, .4);
				margin:5px;
			}
		</style>
	</head>
	<body>
		<div class="container">
		<p class="message">' . $msg . '</p>
		</div>
	</body>
	</html>
	';
    if (!$CHOIR) {
        die("Choir not set");
    }
    $row = mysql_fetch_array(mysql_query("select `admin`, `list` from `choir` where `id` = '{$CHOIR}'"));
    $sender = $row['admin'];
    $recipient = $row['list'];
    $headers = "Content-type:text/html;\n\n" . "From: {$sender}\n" . 'X-Mailer: PHP/' . phpversion();
    mail($to, $subject, $message, $headers);
    //echo $toField." ".$subjectField." ".$messageField." ".$headers;
}
Esempio n. 2
0
function prefFullNameFromEmail($email)
{
    return prefNameFromEmail($email) . ' ' . lastNameFromEmail($email);
}
Esempio n. 3
0
function sendMessageEmail($to, $from, $message, $subjectField = "New Absence Request")
{
    $fromEmail = $from;
    $from = prefNameFromEmail($from) . " " . lastNameFromEmail($from);
    if (strpos($to, ',')) {
        //being sent to multiple people
        $toField = $to;
    } else {
        //being sent to one person
        $toField = prefNameFromEmail($to) . " " . lastNameFromEmail($to) . "<" . $to . ">";
        //make it format: Chris Ernst <*****@*****.**>
    }
    if (!$subjectField) {
        $subjectField = 'Message from ' . $from . '!';
    }
    //if there's no subject, it's a message...maybe.
    $messageField = '
	<html>
	<head>
		<style>
			.container{
				font-family:"lucida grande",tahoma,verdana,arial,sans-serif;
				height:100%;
				padding:5px;
				margin-bottom:3px;
			}
			body{
				background:rgb(179,179,179);
			}
			h1{
				width:100%;
				margin:auto;
				text-align:center;
				text-decoration:underline;
				margin-bottom:3px;
			}
			.from{
				width:100%;
				margin:auto;
				text-align:center;
			}
			.message{
				border-radius:2px;
				background-color:rgba(255,255,255, .7);
				padding:5px;
				border:1px solid rgba(0, 0, 0, 0.1);
				box-shadow:0 4px 7px rgba(0,0,0, .4);
				margin:5px;
			}
		</style>
	</head>
	<body>
		<div class="container">
			<p class="message">' . $message . '</p>
			<p style="float:right;">-' . $from . '</p>
		</div>
	</body>
	</html>
	';
    //reply-to isn't working, but that seems to be alright because the form field is working.
    $headers = 'Content-type:text/html;\\r\\n
				Reply-To: ' . $from . ' <' . $fromEmail . '>' . "\r\n" . 'From: ' . $from . ' <' . $fromEmail . '>' . "\r\n" . 'X-Mailer: PHP/' . phpversion();
    mail($toField, $subjectField, $messageField, $headers);
    //echo $toField." ".$subjectField." ".$messageField." ".$headers;
}
Esempio n. 4
0
function announcements($userEmail)
{
    global $CHOIR;
    $html = "<p class='lead'>Announcements <small>–Obviously each thing is the most important thing.</small></p>";
    //announcement block
    //Show only announcements less than a month old and unarchived
    $sql = "SELECT * FROM `announcement` WHERE date_add(timePosted, INTERVAL 1 MONTH) > now() and `choir` = '{$CHOIR}' AND `archived`=0 ORDER BY `timePosted` DESC LIMIT 0, 3";
    $result = mysql_query($sql);
    while ($announcement = mysql_fetch_array($result)) {
        $timestamp = strtotime($announcement['timePosted']);
        $dayPosted = date('M j, Y', $timestamp);
        $timePosted = date('g:i a', $timestamp);
        $op = $announcement['memberID'];
        $mid = $announcement['announcementNo'];
        $name = prefNameFromEmail($op);
        if (isOfficer($userEmail)) {
            $html .= "<div class='block' id='announce" . $mid . "'><p><b>{$dayPosted} {$timePosted}</b><i class='icon-remove archiveButton' onclick='archiveAnnouncement(" . $mid . ")' style='float: right'></i><br />" . $announcement['announcement'] . "<br /><small style='color:grey'>&mdash;{$name}</small></p></div>";
        } else {
            $html .= "<div class='block'><p><b>{$dayPosted} {$timePosted}</b><br />" . $announcement['announcement'] . "<br /><small style='color:grey'>&mdash;{$name}</small></p></div>";
        }
    }
    $html .= "<button type='button' id='allAnnounceButton' class='btn' href='#annoucnements'>See All Announcements</button>";
    return $html;
}