예제 #1
0
/**
 * Send an html formatted email from a form.
 * @param $dbConn connection
 * @param $sql query. Must produce email1 and name, optional email2.
 * @param $fsubject subject
 * @param $body mail body
 * @param $sender sender email address
 * @param $sender_name sic.
 * and open the template in the editor.
 */
function formMailer($dbConn, $sql, $fsubject, $body, $sender, $sender_name)
{
    $resultSet = $dbConn->Execute($sql);
    if ($resultSet === false) {
        $dbConn->log("<br>Cannot read mail data with <pre>" . $sql . "</pre> reason " . $dbConn->ErrorMsg() . "<br>");
        return;
    }
    $recipients = "";
    $triggerSubject = 'You have mail at your fontys email address';
    $triggerBody = "See the subject. Read your mail" . " e.g. at <a href=\\'http://webmail.fontys.nl\\'>" . "http://webmail.fontys.nl</a><br/>Kind regards, the peerweb service.";
    $bodypostfix = "\n</body>\n</html>\n";
    while (!$resultSet->EOF) {
        extract($resultSet->fields);
        $headers = htmlmailheaders($sender, $sender_name, $email1, $tutor_email);
        $recipients .= "{$name} ({$email1})\n";
        // eval user created subject and body template
        eval("\$subject=\"{$fsubject}\";");
        eval("\$message=\"{$body}\";");
        $bodyprefix = '<!DOCTYPE HTML PUBLIC "-//W3C//DTD HTML 4.01 Transitional//EN">
<html>
<head>
<title>' . $subject . '</title>
<meta http-equiv="Content-Type" content="text/html; charset=UTF-8" >
</head>
<body>';
        domail("{$name} <{$email1}>", $subject, $bodyprefix . $message . $bodypostfix, $headers);
        $resultSet->moveNext();
    }
    $headers = htmlmailheaders($sender, $sender_name, $sender, $tutor_email);
    domail($sender, 'your copy of mail ' . $subject, $bodyprefix . $message . "\n<br/><hr/>The above mail has been sent to the following recipients:\n<pre>\n" . $recipients . "</pre>\n" . $bodypostfix, $headers);
}
예제 #2
0
if (isset($_POST['mailbody'])) {
    $mailbody = $_POST['mailbody'];
}
if (isset($_POST['formsubject'])) {
    $formsubject = $_POST['formsubject'];
}
$mailto = array();
if (isset($_POST['mailto'])) {
    $mailto = $_POST['mailto'];
    //    print_r($mailto);
    $toAddress = '';
    $mailset = '\'' . implode("','", $mailto) . '\'';
    $replyto = getEmailAddresses($dbConn, array($_SESSION['peer_id']));
    $toAddress = getEmailAddresses($dbConn, $_POST['mailto']);
    $headers = "From: peerweb@fontysvenlo.org\n" . "Reply-To: {$replyto}\n" . "Cc: {$replyto}\n";
    $headers = htmlmailheaders($replyto, $sender_name, $toAddress, $ccAddress);
    $subject = $formsubject;
    $bodyprefix = '<!DOCTYPE HTML PUBLIC "-//W3C//DTD HTML 4.01 Transitional//EN">
<html>
<head>
<title>' . $subject . '</title>
<meta http-equiv="Content-Type" content="text/html; charset=UTF-8" >
</head>
<body>
';
    $message = $bodyprefix . $mailbody . "\n</body>\n</html>\n";
    domail($toAddress, $subject, $message, $headers);
    // send author a copy, so he 'll know he is confirmed of sending the email.
    $recipients = htmlentities(preg_replace('/,/', ",\n", $toAddress));
    domail($replyto, $subject . ', your copy', $bodyprefix . $mailbody . "\n<br/><hr/>The above mail has been sent to the following recipients:\n<pre>" . $recipients . "\n</pre>\n" . "\n</body>\n</html>\n", $headers);
    if ($triggerList != '') {
예제 #3
0
파일: imail.php 프로젝트: homberghp/peerweb
            $trigCon = ', ';
        }
        $toAddress .= $tocon . $recipient . ' <' . "{$email1}" . '>';
        $tocon = ', ';
        $resultSet->movenext();
    }
    $sqlsender = "select rtrim(email1) as sender,roepnaam||coalesce(' '||voorvoegsel,'')||' '||achternaam as sender_name," . "coalesce(signature," . "'sent by the peerweb service on behalf of '||roepnaam||coalesce(' '||voorvoegsel,'')||' '||achternaam)\n" . "  as signature from student left join email_signature using(snummer) where snummer='{$peer_id}'";
    $rs = $dbConn->Execute($sqlsender);
    if (!$rs->EOF) {
        extract($rs->fields);
    } else {
        $replyto = '*****@*****.**';
        $sender_name = 'Pieter van den Hombergh';
        $signature = '';
    }
    $headers = htmlmailheaders($sender, $sender_name, $email1, $tutor_email);
    if (!in_array($tutor, $tutors)) {
        array_push($tutors, $tutor);
    }
    foreach ($tutors as $tutor) {
        $ccAddress .= $cccon . getEmailAddress($dbConn, $tutor, true);
        $cccon = ', ';
    }
    if (isset($email2)) {
        $email1 .= ', ' . $email2;
    }
    $subject = $pp['formsubject'];
    $bodyprefix = '<!DOCTYPE HTML PUBLIC "-//W3C//DTD HTML 4.01 Transitional//EN">
<html>
<head>
<title>' . $subject . '</title>