diff --git a/system/sendZugangscode.php b/system/sendZugangscode.php new file mode 100755 index 000000000..00664815e --- /dev/null +++ b/system/sendZugangscode.php @@ -0,0 +1,98 @@ + + */ + +require_once('../config/vilesci.config.inc.php'); +require_once('../include/basis_db.class.php'); +require_once('../include/mail.class.php'); +require_once('../include/person.class.php'); +require_once('../include/kontakt.class.php'); +?> + + + + Check Studenten + + + + + + + +

Email an Neuanfänger schicken

+ +db_query($qry)) +{ + while($row = $db->db_fetch_object($result)) + { + $person = new person(); + $person->load($row->person_id); + + // private email holen + $kontakt = new kontakt(); + $kontakt->load_persKontakttyp($row->person_id, 'email'); + + $name = $row->anrede.' '.$row->nachname; + $zugangscode = $row->zugangscode; + + // Falls mehrere vorhanden sind, an alle schicken + foreach($kontakt->result as $kon) + { + if(sendMail($kon->kontakt, $name, $zugangscode)) + $count+=1; + else + $countError+=1; + } + } +} +else + echo('Fehler bei der Abfrage aufgetreten'); + + +echo 'Email an '.$count.' Empfänger geschickt. Es sind dabei '.$countError.' aufgetreten'; + +function sendMail($email, $name, $zugangscode) +{ + // trim zugangscode + // an private email schicken + + $msg = 'TEXT'; + + $mail = new mail($email, 'no-reply', 'Fotoupload für Ihren FH-Ausweis', 'Bitte sehen Sie sich die Nachricht in HTML Sicht an, um den Link vollständig darzustellen.'); + $mail->setHTMLContent($msg); + if(!$mail->send()) + return true; + else + return false; +} +?> + + \ No newline at end of file