示例#1
0
}
$count = array_merge($count_current, $count_before);
$smtp_server = APF::get_instance()->get_config('smtp_server');
$smtp_port = APF::get_instance()->get_config('smtp_port');
$smtp_user = APF::get_instance()->get_config('smtp_user');
$smtp_pass = APF::get_instance()->get_config('smtp_pass');
$smtp_usermail = APF::get_instance()->get_config('smtp_usermail');
$smtp_emailto = '*****@*****.**';
$cc_to = 'dl-tech-haozu@anjuke.com,dl-tech-pd-aifang@anjuke.com,dl-tech-pdsec@anjuke.com,dl-tech-jpse@anjuke.com,ibug@anjuke.com';
$mail_subject = '[iBug]Daily Reporter' . ' - ' . $date;
$template = new Template();
$mail_body = $template->load_daily_reporter_html_template($count);
$mail_type = 'HTML';
$smtp = new SMTP($smtp_server, $smtp_port, true, $smtp_user, $smtp_pass);
$smtp->debug = true;
$smtp->set_from("IBug No-Reply", $smtp_usermail);
$flag = $smtp->sendmail($smtp_emailto, $smtp_usermail, $mail_subject, $mail_body, $mail_type, $cc_to);
echo date('c ') . "SMTP_SERVER: {$smtp_server} \n";
echo date('c ') . "SUBJECT: {$mail_subject} \n";
echo date('c ') . "FROM: {$smtp_usermail} \n";
echo date('c ') . "TO: {$smtp_emailto} \n";
echo date('c ') . "CC: {$cc_to} \n";
if ($flag) {
    echo date('c ') . "Send Reporter Successfully!\n";
} else {
    $filename = APF::get_instance()->get_config('mail_error_log');
    $content = "Sent Daily Reporter - " . $date . " error\n";
    if (is_writable($filename)) {
        if (!($handle = fopen($filename, 'a'))) {
            echo date('c ') . "Cannot open file " . $filename . "\n";
            exit;
示例#2
0
     }
     // On défine where is the file
     $file_up = $file_dir . $_FILES['file_up']['name'];
 } else {
     // We say that we have uploaded the file
     $up = 1;
     $file_up = 0;
 }
 // We check we have uploaded the file
 if ($up && $no_empty_champs) {
     // We include the SMTP class
     include './Class.SMTP.php';
     // We define the parametres of the SMTP connection
     $smtp = new SMTP($smtp_serveur, $smtp_login, $smtp_passe, 25, $smtp_domain);
     // We int the sender
     $smtp->set_from($_POST['name'], $_POST['email']);
     if ($file_up) {
         // Attach file
         $smtp->add_file($file_up);
     }
     // We define the Content type ( Value can be: html (for html), txt (for text), txt/html (for text and html) )
     $smtp->ContentType = 'txt';
     // We send the mail
     $smtp->smtp_mail($mail_to, $_POST['sujet'], $_POST['msg']);
     // We check that the mail as been send
     if (!$smtp->erreur) {
         echo '<div style="text-align:center; color:#008000;">Your mail as been send.</div>', "\r\n";
         if ($file_up) {
             // Delete tempory file
             unlink($file_up);
         }
*
* Nom de la source :
*       Class SMTP
* Nom du fichier par défaut :
*       Version envoie simple avec une pièce jointe.php
* Auteur :
*       Nuel Guillaume alias Immortal-PC
* Site Web :
*       http://immortal-pc.info/
*
*******************************************************************************/
include './Class.SMTP.php';
$smtp = new SMTP('smtp.serveur.fr', 'login', 'pass', 25, 'immortal-pc.info');
$smtp2 = new SMTP('smtp.serveur_2.fr', 'login', 'pass', 25, 'immortal-pc.info');
$smtp->set_from('Immortal-PC', '*****@*****.**', 'Site web Immortal-PC');
$smtp2->set_from('Immortal-PC', '*****@*****.**', 'Site web Immortal-PC');
// Ajout des fichiers
$smtp->add_file('./Fichier_test.gif');
$smtp->add_file('./Fichier_test.txt');
$smtp2->add_file('./Fichier_test.gif');
$smtp2->add_file('./Fichier_test.txt');
$To = '*****@*****.**';
// A QUI
$Sujet = 'Sujet';
// Sujet
$msg = 'Votre message ici' . "\r\n" . 'ça marche !!';
$smtp->smtp_mail($To, $Sujet, $msg);
// Envoie du mail ( Serveur 1 )
$smtp2->smtp_mail($To, $Sujet, $msg);
// Envoie du mail ( Serveur 2 )
if (!$smtp->erreur) {
示例#4
0
*       http://immortal-pc.info/
*
* Translate by :
*		Pierre CORBEL
* Web site :
*		http://www.some-ideas.net/
*
*******************************************************************************/
include './Class.SMTP.php';
// If the SMTP server requiere authentification
// $smtp = new SMTP('smtp.server.com', 'login', 'pass', 'port', 'domain name', 'Debug; 0 desactivate');
// SMTP without authentification
// $smtp = new SMTP('smtp.server.com', '', '', 25, 'domain name', 'Debug; 0 desactivate');
$smtp = new SMTP('smtp.server.com', 'login', 'pass', 25, 'immortalpc.info', 0);
// From
$smtp->set_from('Immortal-PC', '*****@*****.**');
// To
// Use coma to separate e-mail -> toto@email.com,titi@email.com
//$smtp->Bcc = '*****@*****.**';// For hidden copy
//$smtp->Cc = '*****@*****.**';// For normal copy
// Priority : 1 Urgent, 3 Normal, 6 Slow
$smtp->Priority = 3;
// Content type
$smtp->ContentType = 'text/txt';
// Content type (plain text, html...)
// Reception confirmation
$smtp->Confimation_reception = '';
// Email where wil be send the confirmation
//smtp_mail('*****@*****.**', 'subject', 'message', 'header')
if ($smtp->smtp_mail('*****@*****.**', 'subject', 'message')) {
    echo '<div style="text-align:center; color:#008000;">The email is sended</div>', "\r\n";
示例#5
0
 private function notify()
 {
     $smtpserver = $this->smtp['smtpserver'];
     $smtpserverport = $this->smtp['smtpserverport'];
     $smtpuser = $this->smtp['smtpuser'];
     $smtppass = $this->smtp['smtppass'];
     $smtp_usermail = $this->smtp['smtp_usermail'];
     $smtp = new SMTP($smtpserver, $smtpserverport, false, $smtpuser, $smtppass);
     $smtp->set_from("SearchCloud", "*****@*****.**");
     $smtp->debug = false;
     $cc = '';
     $bcc = '';
     foreach ($this->alert as $name => $msg) {
         if (empty($msg)) {
             continue;
         }
         $userinfo = $this->get_user_info($name);
         print_r($userinfo);
         if (!empty($userinfo['email'])) {
             /*发Email*/
             $sent = $smtp->sendmail($userinfo['email'], $smtp_usermail, 'SearchCloud报警邮件', $msg, 'HTML', $cc, $bcc);
             print_r($sent);
         }
         if (!empty($userinfo['mobile'])) {
             /*发SMS*/
             $sent = $smtp->sendmail($userinfo['mobile'] . '@139.com', $smtp_usermail, 'SearchCloud报警邮件', $msg, 'HTML', $cc, $bcc);
             print_r($sent);
         }
     }
 }