本文整理汇总了PHP中Mailer::sendMail方法的典型用法代码示例。如果您正苦于以下问题:PHP Mailer::sendMail方法的具体用法?PHP Mailer::sendMail怎么用?PHP Mailer::sendMail使用的例子?那么恭喜您, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在类Mailer
的用法示例。
在下文中一共展示了Mailer::sendMail方法的15个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的PHP代码示例。
示例1: sendEmail
public function sendEmail()
{
try {
$emails = explode(',', $this->_correo);
$to = [];
foreach ($emails as $email) {
$params = ['mail' => ['requerido' => 1, 'validador' => 'esEmail', 'mensaje' => utf8_encode('El correo no es válido.')]];
$destinatario = ['name' => $email, 'mail' => $email];
$form = new Validator($destinatario, $params);
if ($form->validate() === false) {
throw new Exception('El correo ' . $email . ' no es válido.');
}
$to[] = $destinatario;
}
$this->_template = ParserTemplate::parseTemplate($this->_template, $this->_info);
// $subject = '', $body = '', $to = array(), $cc = array(), $bcc = array(), $att = array()
if (Mailer::sendMail($this->_subject, $this->_template, $to, $this->_cc)) {
return true;
} else {
return false;
}
} catch (phpmailerException $e) {
$this->_PDOConn->rollBack();
return false;
}
}
示例2: add
function add()
{
$this->booking = new Booking_Class();
$this->booking->booking_id = 'BK' . date("ymdHis");
$this->booking->name = $_POST['name'];
$this->booking->email = $_POST['email'];
$this->booking->phone_number = $_POST['phone'];
$this->booking->source_point = $_POST['source'];
$this->booking->destination_point = $_POST['destination'];
$this->booking->time_of_travel = $_POST['time'];
$this->booking->date_of_travel = $_POST['date'];
$this->booking->number_of_adult_passenger = $_POST['adults'];
$this->booking->number_of_child_passenger = $_POST['children'];
$this->booking->message = $_POST['message'];
if ($this->model->saveBooking($this->booking)) {
$from_email = "sanjibdas86@gmail.com";
$mail = new Mail();
$mail->to = $this->booking->email;
$mail->subject = 'Booking Successfull';
$mail->message = 'Booking with ' . $this->booking->booking_id . ' is successful';
$mail->headers = "From: Sanjib <{$from_email}>\r\n";
Mailer::sendMail($mail);
$this->view->msg = 'BS';
$this->view->booking = $this->booking;
} else {
$this->view->msg = 'Booking Unsuccessfull!!';
}
header('location: ' . URL . 'booking/getbooking/' . $this->booking->booking_id);
}
示例3: sendMail
public function sendMail($template)
{
$template->replaceVars($this->data);
if (Mailer::sendMail($this->data['FirstName'] . ' ' . $this->data['LastName'], $this->data['Email'], $template)) {
$this->increaseSentCount();
return true;
}
return false;
}
示例4: onSetAnswer
public function onSetAnswer(FrontController $sender, Statement $st)
{
$users = $st->getSubscribers();
if ($users) {
require_once ST_DIR . '/Classes/Mailer.php';
$mailer = new Mailer();
$vars = array('answer' => strip_tags($st->getAnswer()), 'st_link' => FrontController::getURLByRoute('view', array('id' => $st->getId()), true), 'title' => $st->getTitle(), 'status' => $st->getStatusName());
foreach ($users as $user) {
$vars['username'] = $user->name;
$vars['unSubscribeLink'] = $this->_getSubscribeLink($user->email, $user->user_id, $st->getId());
$mailer->sendMail('SubscribeStatementSetAnswer', $user->email, $vars);
}
}
}
示例5: send
public function send()
{
Yii::import('application.admin.models.Settings');
if ($this->validate()) {
$s = new Settings();
$m = $this->message;
if (!in_array($this->title, array('Сообщение об ошибке', 'Сообщение по рекламе', 'Сообщение о сотрудничестве', 'Другое'))) {
$this->title = 'Другое';
}
$m .= '<br> от пользователя ' . $this->name . '(' . $this->email . ')';
Mailer::sendMail(array('email' => $s->feedbackEmail), $m, $this->title);
return true;
}
return false;
}
示例6: sendMailFromAgentThird
public static function sendMailFromAgentThird($correo, $mensaje, $archivo = false)
{
$emails = explode(',', $correo);
$to = array();
foreach ($emails as $email) {
$mail = $email;
$destinatario = array('name' => $email, 'mail' => $email);
if (($email = FilterInput::FilterValue($email, 'email', true)) === false) {
throw new Exception('El correo ' . $mail . ' no es válido.');
}
$to[] = $destinatario;
}
$data = array('one' => $mensaje['one'], 'two' => $mensaje['two'], 'three' => $mensaje['three'], 'four' => $mensaje['four'], 'five' => $mensaje['five'], 'six' => $mensaje['six'], 'seven' => $mensaje['seven'], 'eight' => $mensaje['eight'], 'nine' => $mensaje['nine'], 'ten' => $mensaje['ten']);
$tpl = ParserTemplate::parseTemplate('envio_inventario_third.html', $data);
$correos = array(array('mail' => 'jgarcia@cmvasfalto.com.mx', 'name' => 'Jesús'), array('mail' => 'vdavila@cmv.com.mx', 'name' => 'Vico'));
if (Mailer::sendMail('Encuesta ONE / Tercer Review', $tpl, $to, '', $correos)) {
return array('success' => true, 'message' => 'Correo enviado.');
}
}
示例7: sendMail
/**
* send mail by system built-in sendmail commands
* @para string $to, receiver's email address
* @para string $subject, email's subject
* @para string $body, message body
* return array(0=>true|false, 1=>array('error'=>'...'));
*/
function sendMail($to, $subject, $body, $from = '', $local = 0)
{
$rtnarr = array();
if ($local == 0) {
$from = $from == '' ? $_CONFIG['adminmail'] : $from;
$mailstr = 'To:' . $to . '\\n';
$mailstr .= 'Subject:' . $subject . '\\n';
$mailstr .= 'Content-Type:text/html;charset=UTF-8\\n';
$mailstr .= 'From:' . $from . '\\n';
$mailstr .= '\\n';
$mailstr .= $body . '\\n';
$tmpfile = "/tmp/" . GConf::get('agentalias') . ".user.reg.mail.tmp";
system('/bin/echo -e "' . $mailstr . '" > ' . $tmpfile);
system('/bin/cat ' . $tmpfile . ' | /usr/sbin/sendmail -t &');
$rtnarr[0] = true;
} else {
if ($local == 1) {
global $_CONFIG;
include $_CONFIG['appdir'] . "/mod/mailer.class.php";
$_CONFIG['mail_smtp_server'] = "smtp.163.com";
$_CONFIG['mail_smtp_username'] = "wadelau@163.com";
$_CONFIG['mail_smtp_password'] = "myminina.123456";
$_CONFIG['isauth'] = true;
$_CONFIG['mail_smtp_fromuser'] = $_CONFIG['mail_smtp_username'];
$mail = new Mailer($_CONFIG['mail_smtp_server'], 25, $_CONFIG['isauth'], $_CONFIG['mail_smtp_username'], $_CONFIG['mail_smtp_password']);
$mail->debug = true;
$from == '' ? 'bangco@' . $_CONFIG['agentname'] : $from;
if ($_CONFIG['isauth']) {
$from = $_CONFIG['mail_smtp_fromuser'];
}
#print __FILE__.": from:$from";
$rtnarr[0] = $mail->sendMail($to, $from, $subject, $body, 'HTML');
}
}
return $rtnarr;
}
示例8: __
if (empty($data)) {
$response->addError('ERROR_WRONG_DATA', __('twgadmin_wrong_api_data'));
}
if ($mode == 'post') {
if ($object == 'users') {
foreach ($data as $user) {
if (!empty($user['user_id'])) {
if ($_REQUEST['action'] == 'update') {
$result = false;
$user_data = db_get_row("SELECT * FROM ?:users WHERE user_id = ?i", $user['user_id']);
$notify_user = !empty($user['notify_updated_user']) && $user['notify_updated_user'] == 'Y' ? true : false;
if (!empty($user['status']) && !$user['is_complete_data']) {
$result = db_query("UPDATE ?:users SET status = ?s WHERE user_id = ?i", $user['status'], $user['user_id']);
$force_notification = fn_get_notification_rules(array('notify_user' => $noify_user));
if (!empty($force_notification['C']) && $user['status'] == 'A' && $user_data['status'] == 'D') {
Mailer::sendMail(array('to' => $user_data['email'], 'from' => 'company_users_department', 'data' => array('user_data' => $user_data), 'tpl' => 'profiles/profile_activated.tpl', 'company_id' => $user_data['company_id']), fn_check_user_type_admin_area($user_data['user_type']) ? 'A' : 'C', $user_data['lang_code']);
}
}
$temp_auth = null;
$result = fn_twg_api_update_user($user, $temp_auth, $notify_user);
if (!$result) {
$msg = str_replace('[object_id]', $user['user_id'], __('twgadmin_wrong_api_object_data'));
$response->addError('ERROR_OBJECT_UPDATE', str_replace('[object]', 'users', __('twgadmin_wrong_api_object_data')));
}
} elseif ($_REQUEST['action'] == 'delete') {
if (!fn_delete_user($user['user_id'])) {
$msg = str_replace('[object_id]', $user['user_id'], __('twgadmin_wrong_api_object_data'));
$response->addError('ERROR_OBJECT_DELETE', str_replace('[object]', 'users', __('twgadmin_wrong_api_object_data')));
}
}
} else {
示例9: processNewsletter
/**
* Content::processNewsletter()
*
* @return
*/
public function processNewsletter()
{
Filter::checkPost('subject', Core::$word->NL_SUBJECT);
Filter::checkPost('body', Core::$word->NL_BODY);
Filter::checkPost('recipient', Core::$word->NL_RCPT);
if (empty(Filter::$msgs)) {
$to = sanitize($_POST['recipient']);
$subject = sanitize($_POST['subject']);
$body = cleanOut($_POST['body']);
$numSent = 0;
$failedRecipients = array();
switch ($to) {
case "all":
require_once BASEPATH . "lib/class_mailer.php";
$mailer = Mailer::sendMail();
$mailer->registerPlugin(new Swift_Plugins_AntiFloodPlugin(100, 30));
$sql = "SELECT email, CONCAT(fname,' ',lname) as name FROM " . Users::uTable . " WHERE id != 1";
$userrow = Registry::get("Database")->fetch_all($sql);
$replacements = array();
if ($userrow) {
if (empty($_FILES['attachment']['name'])) {
$attachement = '';
} else {
move_uploaded_file($_FILES['attachment']['tmp_name'], UPLOADS . 'attachments/' . $_FILES['attachment']['name']);
$attachement = '<a href="' . SITEURL . '/uploads/attachments/' . $_FILES['attachment']['name'] . '">' . Core::$word->NL_ATTACH . '</a>';
}
foreach ($userrow as $cols) {
$replacements[$cols->email] = array('[NAME]' => $cols->name, '[ATTACHMENT]', '[SITE_NAME]' => Registry::get("Core")->site_name, '[URL]' => Registry::get("Core")->site_url);
}
$decorator = new Swift_Plugins_DecoratorPlugin($replacements);
$mailer->registerPlugin($decorator);
$message = Swift_Message::newInstance()->setSubject($subject)->setFrom(array(Registry::get("Core")->site_email => Registry::get("Core")->site_name))->setBody($body, 'text/html');
foreach ($userrow as $row) {
$message->setTo(array($row->email => $row->name));
$numSent++;
$mailer->send($message, $failedRecipients);
}
unset($row);
}
break;
case "newsletter":
require_once BASEPATH . "lib/class_mailer.php";
$mailer = Mailer::sendMail();
$mailer->registerPlugin(new Swift_Plugins_AntiFloodPlugin(100, 30));
$sql = "SELECT email, CONCAT(fname,' ',lname) as name FROM " . Users::uTable . " WHERE newsletter = '1' AND id != 1";
$userrow = Registry::get("Database")->fetch_all($sql);
$replacements = array();
if ($userrow) {
if (empty($_FILES['attachment']['name'])) {
$attachement = '';
} else {
move_uploaded_file($_FILES['attachment']['tmp_name'], UPLOADS . 'attachments/' . $_FILES['attachment']['name']);
$attachement = '<a href="' . SITEURL . '/uploads/attachments/' . $_FILES['attachment']['name'] . '">' . Core::$word->NL_ATTACH . '</a>';
}
foreach ($userrow as $cols) {
$replacements[$cols->email] = array('[NAME]' => $cols->name, '[ATTACHMENT]', '[SITE_NAME]' => Registry::get("Core")->site_name, '[URL]' => Registry::get("Core")->site_url);
}
$decorator = new Swift_Plugins_DecoratorPlugin($replacements);
$mailer->registerPlugin($decorator);
$message = Swift_Message::newInstance()->setSubject($subject)->setFrom(array(Registry::get("Core")->site_email => Registry::get("Core")->site_name))->setBody($body, 'text/html');
if (!empty($_FILES['attachment']['name'])) {
move_uploaded_file($_FILES['attachment']['tmp_name'], UPLOADS . 'attachments/' . $_FILES['attachment']['name']);
$attachement = $_FILES['attachment']['name'];
}
foreach ($userrow as $row) {
$message->setTo(array($row->email => $row->name));
$numSent++;
$mailer->send($message, $failedRecipients);
}
unset($row);
}
break;
case "free":
require_once BASEPATH . "lib/class_mailer.php";
$mailer = Mailer::sendMail();
$mailer->registerPlugin(new Swift_Plugins_AntiFloodPlugin(100));
$sql = "SELECT email,CONCAT(fname,' ',lname) as name FROM " . Users::uTable . " WHERE membership_id = 0 AND id != 1";
$userrow = Registry::get("Database")->fetch_all($sql);
$replacements = array();
if ($userrow) {
if (empty($_FILES['attachment']['name'])) {
$attachement = '';
} else {
move_uploaded_file($_FILES['attachment']['tmp_name'], UPLOADS . 'attachments/' . $_FILES['attachment']['name']);
$attachement = '<a href="' . SITEURL . '/uploads/attachments/' . $_FILES['attachment']['name'] . '">' . Core::$word->NL_ATTACH . '</a>';
}
foreach ($userrow as $cols) {
$replacements[$cols->email] = array('[NAME]' => $cols->name, '[ATTACHMENT]', '[SITE_NAME]' => Registry::get("Core")->site_name, '[URL]' => Registry::get("Core")->site_url);
}
$decorator = new Swift_Plugins_DecoratorPlugin($replacements);
$mailer->registerPlugin($decorator);
$message = Swift_Message::newInstance()->setSubject($subject)->setFrom(array(Registry::get("Core")->site_email => Registry::get("Core")->site_name))->setBody($body, 'text/html');
foreach ($userrow as $row) {
$message->setTo(array($row->email => $row->name));
$numSent++;
//.........这里部分代码省略.........
示例10: fn_qwintry_update_shipment
function fn_qwintry_update_shipment($shipment_data, $shipment_id = 0, $group_key = 0, $all_products = false, $force_notification = array())
{
if (!empty($shipment_id)) {
$arow = db_query("UPDATE ?:shipments SET tracking_number = ?s, carrier = ?s WHERE shipment_id = ?i", $shipment_data['tracking_number'], $shipment_data['carrier'], $shipment_id);
if ($arow === false) {
fn_set_notification('E', __('error'), __('object_not_found', array('[object]' => __('shipment'))), '', '404');
$shipment_id = false;
}
} else {
if (empty($shipment_data['order_id']) || empty($shipment_data['shipping_id'])) {
return false;
}
$order_info = fn_get_order_info($shipment_data['order_id'], false, true, true);
$use_shipments = Settings::instance()->getValue('use_shipments', '', $order_info['company_id']) == 'Y' ? true : false;
if (!$use_shipments && empty($shipment_data['tracking_number']) && empty($shipment_data['tracking_number'])) {
return false;
}
if ($all_products) {
foreach ($order_info['product_groups'] as $group) {
foreach ($group['products'] as $item_key => $product) {
if (!empty($product['extra']['group_key'])) {
if ($group_key == $product['extra']['group_key']) {
$shipment_data['products'][$item_key] = $product['amount'];
}
} elseif ($group_key == 0) {
$shipment_data['products'][$item_key] = $product['amount'];
}
}
}
}
if (!empty($shipment_data['products']) && fn_check_shipped_products($shipment_data['products'])) {
fn_set_hook('create_shipment', $shipment_data, $order_info, $group_key, $all_products);
foreach ($shipment_data['products'] as $key => $amount) {
if (isset($order_info['products'][$key])) {
$amount = intval($amount);
if ($amount > $order_info['products'][$key]['amount'] - $order_info['products'][$key]['shipped_amount']) {
$shipment_data['products'][$key] = $order_info['products'][$key]['amount'] - $order_info['products'][$key]['shipped_amount'];
}
}
}
if (fn_check_shipped_products($shipment_data['products'])) {
$shipment_data['timestamp'] = time();
$shipment_id = db_query("INSERT INTO ?:shipments ?e", $shipment_data);
foreach ($shipment_data['products'] as $key => $amount) {
if ($amount == 0) {
continue;
}
$_data = array('item_id' => $key, 'shipment_id' => $shipment_id, 'order_id' => $shipment_data['order_id'], 'product_id' => $order_info['products'][$key]['product_id'], 'amount' => $amount);
db_query("INSERT INTO ?:shipment_items ?e", $_data);
}
if (fn_check_permissions('orders', 'update_status', 'admin') && !empty($shipment_data['order_status'])) {
fn_change_order_status($shipment_data['order_id'], $shipment_data['order_status']);
}
/**
* Called after new shipment creation.
*
* @param array $shipment_data Array of shipment data.
* @param array $order_info Shipment order info
* @param int $group_key Group number
* @param bool $all_products
* @param int $shipment_id Created shipment identifier
*/
fn_set_hook('create_shipment_post', $shipment_data, $order_info, $group_key, $all_products, $shipment_id);
if (!empty($force_notification['C'])) {
$shipment = array('shipment_id' => $shipment_id, 'timestamp' => $shipment_data['timestamp'], 'shipping' => db_get_field('SELECT shipping FROM ?:shipping_descriptions WHERE shipping_id = ?i AND lang_code = ?s', $shipment_data['shipping_id'], $order_info['lang_code']), 'tracking_number' => $shipment_data['tracking_number'], 'carrier' => $shipment_data['carrier'], 'comments' => $shipment_data['comments'], 'items' => $shipment_data['products']);
Mailer::sendMail(array('to' => $order_info['email'], 'from' => 'company_orders_department', 'data' => array('shipment' => $shipment, 'order_info' => $order_info), 'tpl' => 'shipments/shipment_products.tpl', 'company_id' => $order_info['company_id']), 'C', $order_info['lang_code']);
}
fn_set_notification('N', __('notice'), __('shipment_has_been_created'));
}
} else {
fn_set_notification('E', __('error'), __('products_for_shipment_not_selected'));
}
}
return $shipment_id;
}
示例11: activateAccount
/**
* User::activateAccount()
*
* @return
*/
public function activateAccount()
{
$data['active'] = "y";
self::$db->update(self::uTable, $data, "id = " . Filter::$id);
require_once BASEPATH . "lib/class_mailer.php";
$row = Registry::get("Core")->getRowById(Content::eTable, 16);
$usr = Registry::get("Core")->getRowById(self::uTable, Filter::$id);
$body = str_replace(array('[NAME]', '[URL]', '[SITE_NAME]'), array($usr->fname . ' ' . $usr->lname, SITEURL, Registry::get("Core")->site_name), $row->body);
$newbody = cleanOut($body);
$mailer = Mailer::sendMail();
$message = Swift_Message::newInstance()->setSubject($row->subject)->setTo(array($usr->email => $usr->username))->setFrom(array(Registry::get("Core")->site_email => Registry::get("Core")->site_name))->setBody($newbody, 'text/html');
if ($data['active'] == "y") {
$json['type'] = 'success';
$json['title'] = Core::$word->SUCCESS;
$json['message'] = Core::$word->UR_ACCOK;
print json_encode($json);
} else {
$json['type'] = 'error';
$json['title'] = Core::$word->ERROR;
$json['message'] = Core::$word->UR_ACCERR;
print json_encode($json);
}
}
示例12: Mailer
$email_body = <<<EOF
\t\t\tEr is een nieuwe aanvraag binnengekomen van de site CheckJeStress.nl:<br><br>
\t\t\tPersoonsinformatie:<br>
\t\t\t<ul>
\t\t\t\t{$naam}<br>
\t\t\t\t{$email}
\t\t\t</ul>
\t\t\t<br>
\t\t\tDeze persoon heeft interesse in de volgende zaken:
\t\t\t<ul>{$aanvinkvelden}</ul>
\t\t\tDeze persoon liet het volgende bericht achter:<br>
\t\t\t<ul>{$bericht}</ul>;
EOF;
include '../resources/includes/PHPMailer/mail.php';
$mail = new Mailer($page->getConfig()['email']);
$mail->sendMail([$to], $email_subject, $email_body, $email_body);
$message = <<<EOF
\t\t\tHartelijk bedankt voor het versturen van uw contactformulier!<br>
\t\t\tEr zal zo spoedig mogelijk contact met u op worden genomen.<br>
\t\t\t<a href="">Klik hier</a> om terug te keren naar de homepage.
EOF;
}
}
$page->body = <<<CONTENT
\t<div class="content">
\t <section class="text water" id="first">
\t <div class="row">
\t <div class="medium-10 medium-centered columns">
\t <div class="medium-9 columns medium-offset-3">
\t <h5>Contact</h1>
\t\t\t \t\t<p>{$message}</p>
示例13: membershipCron
/**
* Membership::membershipCron()
*
* @param mixed $days
* @return
*/
function membershipCron($days)
{
$sql = "SELECT u.id, CONCAT(u.fname,' ',u.lname) as name, u.email, u.membership_id, u.trial_used, m.title, m.days," . "\n DATE_FORMAT(u.mem_expire, '%d %b %Y') as edate" . "\n FROM " . Users::uTable . " as u" . "\n LEFT JOIN " . self::mTable . " AS m ON m.id = u.membership_id" . "\n WHERE u.active = 'y' AND u.membership_id !=0" . "\n AND TO_DAYS(u.mem_expire) - TO_DAYS(NOW()) = '" . (int) $days . "'";
$listrow = $db->fetch_all($sql);
require_once BASEPATH . "lib/class_mailer.php";
if ($listrow) {
switch ($days) {
case 7:
$mailer = Mailer::sendMail();
$mailer->registerPlugin(new Swift_Plugins_AntiFloodPlugin(100, 30));
$trow = Registry::get("Core")->getRowById(Content::eTable, 8);
$body = cleanOut($trow->body);
$replacements = array();
foreach ($listrow as $cols) {
$replacements[$cols->email] = array('[NAME]' => $cols->name, '[SITE_NAME]' => Registry::get("Core")->site_name, '[URL]' => Registry::get("Core")->site_url);
}
$decorator = new Swift_Plugins_DecoratorPlugin($replacements);
$mailer->registerPlugin($decorator);
$message = Swift_Message::newInstance()->setSubject($trow->subject)->setFrom(array(Registry::get("Core")->site_email => Registry::get("Core")->site_name))->setBody($body, 'text/html');
foreach ($listrow as $row) {
$message->setTo(array($row->email => $row->name));
$mailer->send($message);
}
unset($row);
break;
case 0:
$mailer = Mailer::sendMail();
$mailer->registerPlugin(new Swift_Plugins_AntiFloodPlugin(100, 30));
$trow = Registry::get("Core")->getRowById(Content::eTable, 9);
$body = cleanOut($trow->body);
$replacements = array();
foreach ($listrow as $cols) {
$replacements[$cols->email] = array('[NAME]' => $cols->name, '[SITE_NAME]' => Registry::get("Core")->site_name, '[URL]' => Registry::get("Core")->site_url);
}
$decorator = new Swift_Plugins_DecoratorPlugin($replacements);
$mailer->registerPlugin($decorator);
$message = Swift_Message::newInstance()->setSubject($trow->subject)->setFrom(array($core->site_email => $core->site_name))->setBody($body, 'text/html');
foreach ($listrow as $row) {
$message->setTo(array($row->email => $row->name));
$data = array('membership_id' => 0, 'mem_expire' => "0000-00-00 00:00:00");
self::$db->update(Users::uTable, $data, "id = " . $row->id);
$mailer->send($message);
}
unset($row);
break;
}
}
}
示例14: sendConfirmationMail
private function sendConfirmationMail($hash)
{
$mail = new Mailer();
$mail->setHost('wp381.webpack.hosteurope.de');
$mail->setUsername('wp11164385-noreply');
$mail->setPassword('Mg!ht+opJ');
$mail->setAuth(true);
$subject = 'Der Bestätigungslink zu Ihrer Registrierung bei MolBiomed der Uni Bonn';
$to = Request::getInstance()->getPostRequests('ag_username');
$mailText = 'Herzlichen Dank für Ihr Interesse an unserem Studienprogramm und Ihre Registrierung! Zur Aktivierung Ihrer Anmeldung klicken Sie bitte auf folgenden Link:'."\n\n";
if(LOCAL)
$mailText .= "http://www.limes.lan/index.php?registrieren=".$hash;
else
$mailText .= "http://www.molbiomed-bewerbung.de/index.php?registrieren=".$hash;
$mailText .= "\n\n";
$mailText .="Datenschutzerklärung\n\n";
$mailText .="Die Rheinische Friedrich-Wilhelms-Universität Bonn legt großen Wert auf den Schutz Ihrer personenbezogenen Daten. Die Verarbeitung dieser Daten erfolgt durch das Koordinationsbüro der Universität Bonn im Rahmen der gesetzlichen Bestimmungen des Landesdatenschutzgesetzes NRW. Die im Online-Formular abgefragten personenbezogenen Daten werden ausschließlich zum Zweck der Abwicklung des Bewerbungsverfahrens erhoben, gespeichert und genutzt. Eine Übermittlung der Daten an andere Stellen innerhalb der Universität erfolgt im Rahmen der gesetzlichen Bestimmungen ebenfalls nur, soweit dies zur Abwicklung des Bewerbungsverfahrens erforderlich ist.\n\n";
$mailText .="Mit freundlichen Grüßen, \n\n";
$mailText .="Ihr Team \nder Molekularen Biomedizin\nder Rheinischen Friedrich-Wilhelms Universität Bonn\n\n";
$mailText .= "____________________________\n\nProf. Dr. Thorsten Lang\nLIMES Institute\nMembrane Biochemistry\nCarl-Troll-Straße 31\n53115 Bonn \n";
$from = 'noreply@molbiomed-bewerbung.de';
$mail->sendMail($to, $subject, utf8_decode($mailText), $from);
}
示例15: addUserFromCommerce
function addUserFromCommerce()
{
$AppModel = new Model();
$Utente = new UtenteModel();
$Uform = new UtenteForm();
$Dbase = new DatabaseModel();
$Dform = new DatabaseForm();
$Assoc = new AssociazioneModel();
$Aform = new AssociazioneForm();
$request = Slim::getInstance()->request();
$user = json_decode($request->getBody());
//Utente
$Uform->email = trim_string($user->email);
$Uform->id_utente = null;
$pwd = Password::randomPassword();
$Uform->passwd = Password::hashPassword($pwd);
$Uform->nome = $user->nome;
$numdb = (int) $user->num_db;
//TODO: Check for empty number of databases
$id_utente = $AppModel->getIdUtente($Uform->email);
$piva = trim_string($user->piva);
$dbprogr = $AppModel->getNumDB($user->email);
$INI = $dbprogr;
$FIN = $dbprogr + $numdb;
/////////////////////////////////////////////////////////////////////////check if fields are not empty///////////////////////////////
if (!empty($user->email) && !empty($user->piva) && !empty($user->num_db)) {
try {
///////////////////////////////////////////////////checks if user exist already or no ///////////////////////////////////////
if (empty($id_utente)) {
$Utente->saveDb($Uform, 1, 1);
$testo = "<p>Salve {$user->email},</p>\r\n <p>i tuoi dati di accesso presso <b>" . NAME . ":</b><br><br>\r\n <b>Nome utente</b>: {$user->email}<br>\r\n <b>Password:</b> {$pwd}</p>\r\n <p>Una volta effettuato l'accesso ti verrà richiesto di cambiare la password tramite l'apposita funzionalità</p>\r\n <p>Adesso puoi effettuare il login al seguente indirizzo: <a href=\"" . URL . "index.php?section=login\">" . URL . "index.php?section=login</a></p>";
Mailer::sendMail($user->email, NAME, EMAIL, false, NAME . ' - Utente e password', $testo);
//////////////////////////////////////////////////////////////creates number of databases rquested/////////////////////////////////////////////////
$Dform->alias = (string) $user->ragsoc;
$dbnames = createDBName($INI, $FIN, $piva);
foreach ($dbnames as $key => $value) {
$id_database = $AppModel->getIdDb($value);
if (empty($id_database)) {
$Dform->nome = $value;
$Dform->codice = explode("_", $value)[1];
if (!$Dbase->esisteDatabase($Dform->nome)) {
$Dbase->saveDb($Dform);
if (!file_exists(PATH_BASE . DS . CSV . DS . $Dform->codice) && !is_dir(PATH_BASE . DS . CSV . DS . $Dform->codice)) {
mkdir(PATH_BASE . DS . CSV . DS . $Dform->codice, 0777, true);
}
}
}
$Aform->id_utente = $AppModel->getIdUtente($user->email);
$Aform->id_database = $AppModel->getIdDb($Dform->nome);
// use name inserted into db ...not something else
$Aform->id_associazione = $Assoc->getIDAssociazione($Aform->id_database, $Aform->id_utente);
$Aform->data_scadenza = (string) $user->data_scadenza;
if (!$Assoc->controllaUnicita($Aform->id_utente, $Aform->id_database, $Aform->id_associazione)) {
$Assoc->saveDb($Aform, 1, 1);
}
// Check if flight is set, enable menu and impose other conditions.
if ($user->tipo_gest == '1') {
$Dbase->setAuth($AppModel->getIdDb($Dform->nome), 3, 1);
$Dbase->ImpostazioneFlight($Dform->nome);
}
}
//check for errors
$AppModel->updateNumDB($Uform->email, $numdb);
// TODO: Use error checks to send different jsons that is 1 .error in utente, 2. error in database 3.associazione
$status = array("statuscode" => 200, "response" => array("success" => true, "msg" => "Richiesta eseguita con successo. E stato creato un utente, un database e un abbinamento/associazione.", "data" => array()));
echo json_encode($status);
} else {
// if user doesn't exist
// 3. send email
//2. create db,
//create assocciazione with all
$Dform->alias = (string) $user->ragsoc;
$dbnames = createDBName($INI, $FIN, $piva);
foreach ($dbnames as $key => $value) {
$id_database = $AppModel->getIdDb($value);
if (empty($id_database)) {
$Dform->nome = $value;
$Dform->codice = explode("_", $value)[1];
if (!$Dbase->esisteDatabase($Dform->nome)) {
$Dbase->saveDb($Dform);
if (!file_exists(PATH_BASE . DS . CSV . DS . $Dform->codice) && !is_dir(PATH_BASE . DS . CSV . DS . $Dform->codice)) {
mkdir(PATH_BASE . DS . CSV . DS . $Dform->codice, 0777, true);
}
}
// else check for errors
}
//$checkdbname = $Dbase->getDatabase($id_database);
// check if database exist already
// if so try create associasion
//else create db and create association
$Aform->id_utente = $AppModel->getIdUtente($user->email);
$Aform->id_database = $AppModel->getIdDb($Dform->nome);
// use name inserted into db ...not something else
$Aform->id_associazione = $Assoc->getIDAssociazione($Aform->id_database, $Aform->id_utente);
$Aform->data_scadenza = (string) $user->data_scadenza;
if (!$Assoc->controllaUnicita($Aform->id_utente, $Aform->id_database, $Aform->id_associazione)) {
$Assoc->saveDb($Aform, 1, 1);
}
// user alreadey exist send check if database exist and check if associzoine exist then send email
$testo = "<p>Salve {$user->email},</p>\r\n <p>La sua richiesta è stata accettata. Abbiamo abbinato una nuova basi di dati a questo utente.</p>\r\n <p>i tuoi dati di accesso presso <b>" . NAME . ":</b><br>\r\n <p>Si potrebbe usare le tue credenziali già esistente per accedere.</p>\r\n <p></p>\r\n <p>Adesso puoi effettuare il login al seguente indirizzo: <a href=\"" . URL . "index.php?section=login\">" . URL . "index.php?section=login</a></p>";
//.........这里部分代码省略.........