Пример #1
0
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;
}
Пример #2
0
function prefFullNameFromEmail($email)
{
    return prefNameFromEmail($email) . ' ' . lastNameFromEmail($email);
}
Пример #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;
}