Beispiel #1
0
function send_mail($email, $subject, $send_email, $send_name, $content, $send_time, $client, $token)
{
    $send_group = intval(create_email($email, $client, $token));
    $template_id = intval(create_template($subject, $send_email, $send_name, $content, $client, $token));
    $send_group = $send_group . '';
    try {
        //禁止发送的组,多个组用英文逗号隔开
        $forbidden_group = '-1';
        $client->createPlan($token, $template_id, $send_time, $send_group, $forbidden_group);
        return "success";
    } catch (XML_RPC2_FaultException $e) {
        // The XMLRPC server returns a XMLRPC error
        return 'Exception #' . $e->getFaultCode() . ' : ' . $e->getFaultString();
    } catch (Exception $e) {
        // Other errors (HTTP or networking problems...)
        return 'Exception : ' . $e->getMessage();
    }
}
//$body = fread($handle, 4096);
$subject = "Jesus May Ball - Staffing Application";
$headers = "MIME-Version: 1.0" . "\r\n";
// $headers .= "BCC: mayball-staffing@jesus.cam.ac.uk\r\n"; \\ Turn on if you want to be CCed emails
$headers .= "Content-type:text/html;charset=iso-8859-1" . "\r\n";
$headers .= "From: mayball-staffing@jesus.cam.ac.uk\r\n" . "X-Mailer: php";
if ($_POST["Group"] == "true") {
    $body = create_email_group($submit["txtName"], $submit["txtName2"], $submit["txtName3"], $submit["txtName4"]);
    $email2 = $submit["txtEmail2"];
    mail($email2, $subject, $body, $headers);
    $email3 = $submit["txtEmail3"];
    mail($email3, $subject, $body, $headers);
    $email4 = $submit["txtEmail4"];
    mail($email4, $subject, $body, $headers);
} else {
    $body = create_email($submit["txtName"]);
    mail($email, $subject, $body, $headers);
}
?>

<!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.0 Transitional//EN" "http://www.w3.org/TR/xhtml1/DTD/xhtml1-transitional.dtd">
<html xmlns="http://www.w3.org/1999/xhtml">
<head>
<meta http-equiv="Content-Type" content="text/html; charset=utf-8" />
<title>Jesus May Ball 2012</title>
<link href="style1.css" rel="stylesheet" type="text/css" />
</head>

<body>
<p>
</p>