/**
  * @return ilMimeMail
  */
 protected function initMimeMail()
 {
     /**
      * @var $ilSetting ilSetting
      */
     global $ilSetting;
     $this->mime_mail = new ilMimeMail();
     $this->mime_mail->From($ilSetting->get('admin_email'));
     $this->mime_mail->autoCheck(false);
     return $this->mime_mail;
 }
 function sendMail($sid, $to, $cc, $bcc, $sender, $subject, $message, $attach)
 {
     $this->initAuth($sid);
     $this->initIlias();
     if (!$this->__checkSession($sid)) {
         return $this->__raiseError($this->__getMessage(), $this->__getMessageCode());
     }
     global $ilLog;
     include_once 'Services/Mail/classes/class.ilMimeMail.php';
     $mmail = new ilMimeMail();
     $mmail->autoCheck(false);
     $mmail->From($sender);
     $mmail->To(explode(',', $to));
     $mmail->Subject($subject);
     $mmail->Body($message);
     if ($cc) {
         $mmail->Cc(explode(',', $cc));
     }
     if ($bcc) {
         $mmail->Bcc(explode(',', $bcc));
     }
     if ($attach) {
         // mjansen: switched separator from "," to "#:#" because of mantis bug #6039
         // for backward compatibility we have to check if the substring "#:#" exists as leading separator
         // otherwise we should use ";"
         if (strpos($attach, '#:#') === 0) {
             $attach = substr($attach, strlen('#:#'));
             $attachments = explode('#:#', $attach);
         } else {
             $attachments = explode(',', $attach);
         }
         foreach ($attachments as $attachment) {
             $mmail->Attach($attachment);
         }
     }
     $mmail->Send();
     $ilLog->write('SOAP: sendMail(): ' . $to . ', ' . $cc . ', ' . $bcc);
     return true;
 }
 /**
  * Execute notification
  *
  * @return bool
  */
 public function notify()
 {
     global $ilSetting;
     if (!$this->email) {
         return false;
     }
     $this->mailer->To($this->email);
     $from = $ilSetting->get('mail_external_sender_noreply');
     if ($from) {
         $this->mailer->From($from);
     }
     $this->mailer->Subject($this->getSubject());
     $this->mailer->Body($this->getBody());
     if ($this->attach_certificate) {
         $this->mailer->Attach($this->certificate->getFilePath());
     }
     $this->mailer->Send();
     return true;
 }
 public function send()
 {
     global $lng;
     $customer_array = $this->_getObjectsToRemind();
     foreach ($customer_array as $user_id => $objects_array) {
         $this->initLanguage($user_id);
         $user_lang = $this->getLanguage() ? $this->getLanguage() : $lng;
         $this->initMail();
         $this->setRecipients($user_id);
         $this->setSubject($this->getLanguageText('payment_reminder_notification_subject'));
         $this->setBody(ilMail::getSalutation($user_id, $this->getLanguage()));
         $this->appendBody("\n\n");
         $this->appendBody($user_lang->txt('bought_objects_expire_soon'));
         $this->appendBody("\n\n");
         foreach ($objects_array as $key => $pobject) {
             $this->appendBody("----------------------------------------------------------------------------------------------");
             $this->appendBody("\n\n");
             $this->appendBody($user_lang->txt('title') . ": " . $objects_array[$key]['object_title'] . "\n");
             $this->appendBody($user_lang->txt('access_enddate') . ": " . $objects_array[$key]['access_enddate']);
             $this->appendBody("\n");
             $this->appendBody("\n\n");
         }
         $this->appendBody("----------------------------------------------------------------------------------------------");
         //@todo fix this: $mailbox_link
         $this->appendBody($mailbox_link);
         $this->appendBody("\n\n");
         $this->appendBody(ilMail::_getAutoGeneratedMessageString($this->getLanguage()));
         $this->appendBody(ilMail::_getInstallationSignature());
         $mmail = new ilMimeMail();
         $mmail->autoCheck(false);
         $mmail->From('noreply');
         $mmail->To(ilObjUser::_lookupEmail($user_id));
         $mmail->Subject($this->getSubject());
         $mmail->Body($this->getBody());
         $mmail->Send();
     }
 }
 public static function _createRandomUserAccount($keyarray)
 {
     global $ilDB, $ilUser, $ilSetting, $rbacadmin;
     if ($_SESSION['create_user_account'] != NULL) {
         $obj_user = new ilObjUser($_SESSION['create_user_account']);
         return $obj_user;
     } else {
         $userLogin = array();
         $res = $ilDB->query('SELECT sequence FROM object_data_seq');
         $row = $ilDB->fetchAssoc($res);
         $temp_user_id = (int) $row['sequence'] + 1;
         $userLogin['login'] = '******' . $temp_user_id;
         $userLogin['passwd'] = ilUtil::generatePasswords(1);
         require_once 'Services/User/classes/class.ilObjUser.php';
         include_once "Services/Mail/classes/class.ilAccountMail.php";
         $obj_user = new ilObjUser();
         $obj_user->setId($temp_user_id);
         $obj_user->setLogin($userLogin['login']);
         $obj_user->setPasswd((string) $userLogin['passwd'][0], IL_PASSWD_PLAIN);
         $_SESSION['tmp_user_account']['login'] = $userLogin['login'];
         $_SESSION['tmp_user_account']['passwd'] = $userLogin['passwd'];
         $obj_user->setFirstname($keyarray['first_name']);
         $obj_user->setLastname($keyarray['last_name']);
         $obj_user->setEmail($keyarray['payer_email']);
         #	$obj_user->setEmail('*****@*****.**');
         $obj_user->setGender('f');
         $obj_user->setLanguage($ilSetting->get("language"));
         $obj_user->setActive(true);
         $obj_user->setTimeLimitUnlimited(true);
         $obj_user->setTitle($obj_user->getFullname());
         $obj_user->setDescription($obj_user->getEmail());
         $obj_user->setTimeLimitOwner(7);
         $obj_user->setTimeLimitUnlimited(1);
         $obj_user->setTimeLimitMessage(0);
         $obj_user->setApproveDate(date("Y-m-d H:i:s"));
         // Set default prefs
         $obj_user->setPref('hits_per_page', $ilSetting->get('hits_per_page', 30));
         $obj_user->setPref('show_users_online', $ilSetting->get('show_users_online', 'y'));
         $obj_user->writePrefs();
         // at the first login the user must complete profile
         $obj_user->setProfileIncomplete(true);
         $obj_user->create();
         $obj_user->saveAsNew();
         $user_role = ilObject::_exists(4, false);
         if (!$user_role) {
             include_once "./Services/AccessControl/classes/class.ilObjRole.php";
             $reg_allowed = ilObjRole::_lookupRegisterAllowed();
             $user_role = $reg_allowed[0]['id'];
         } else {
             $user_role = 4;
         }
         $rbacadmin->assignUser((int) $user_role, $obj_user->getId(), true);
         include_once "Services/Mail/classes/class.ilMimeMail.php";
         global $ilias, $lng;
         $settings = $ilias->getAllSettings();
         $mmail = new ilMimeMail();
         $mmail->autoCheck(false);
         $mmail->From($settings["admin_email"]);
         $mmail->To($obj_user->getEmail());
         // mail subject
         $subject = $lng->txt("reg_mail_subject");
         // mail body
         $body = $lng->txt("reg_mail_body_salutation") . " " . $obj_user->getFullname() . ",\n\n" . $lng->txt("reg_mail_body_text1") . "\n\n" . $lng->txt("reg_mail_body_text2") . "\n" . ILIAS_HTTP_PATH . "/login.php?client_id=" . $ilias->client_id . "\n";
         $body .= $lng->txt("login") . ": " . $obj_user->getLogin() . "\n";
         $body .= $lng->txt("passwd") . ": " . $userLogin['passwd'][0] . "\n";
         $body .= "\n";
         $body .= $lng->txt("reg_mail_body_text3") . "\n\r";
         $body .= $obj_user->getProfileAsString($lng);
         $mmail->Subject($subject);
         $mmail->Body($body);
         $mmail->Send();
         $_SESSION['create_user_account'] = $obj_user->getId();
         return $obj_user;
     }
 }
 /**
  * send mime mail using class.ilMimeMail.php
  * All external mails are send to SOAP::sendMail starting a kind of background process
  * @param string of recipients
  * @param string of recipients
  * @param string of recipients
  * @param string subject
  * @param string message
  * @param array attachments
  * @param bool prevent soap
  * @access	public
  * @return	array of saved data
  */
 function sendMimeMail($a_rcp_to, $a_rcp_cc, $a_rcp_bcc, $a_m_subject, $a_m_message, $a_attachments, $a_no_soap = false)
 {
     include_once "Services/Mail/classes/class.ilMimeMail.php";
     #var_dump("<pre>",$a_rcp_to,$a_rcp_cc,$a_rcp_bcc,$a_m_subject,$a_m_message,$a_attachments,"<pre>");
     #$inst_name = $this->ilias->getSetting("inst_name") ? $this->ilias->getSetting("inst_name") : "ILIAS 4";
     #$a_m_subject = "[".$inst_name."] ".$a_m_subject;
     $a_m_subject = self::getSubjectPrefix() . ' ' . $a_m_subject;
     $sender = $this->getMimeMailSender();
     // #10854
     if ($this->isSOAPEnabled() && !$a_no_soap) {
         // Send per soap
         include_once 'Services/WebServices/SOAP/classes/class.ilSoapClient.php';
         $soap_client = new ilSoapClient();
         $soap_client->setResponseTimeout(1);
         $soap_client->enableWSDL(true);
         $soap_client->init();
         $attachments = array();
         $a_attachments = $a_attachments ? $a_attachments : array();
         foreach ($a_attachments as $attachment) {
             $attachments[] = $this->mfile->getAbsolutePath($attachment);
         }
         // mjansen: switched separator from "," to "#:#" because of mantis bug #6039
         $attachments = implode('#:#', $attachments);
         // mjansen: use "#:#" as leading delimiter
         if (strlen($attachments)) {
             $attachments = "#:#" . $attachments;
         }
         $soap_client->call('sendMail', array($_COOKIE['PHPSESSID'] . '::' . $_COOKIE['ilClientId'], $a_rcp_to, $a_rcp_cc, $a_rcp_bcc, $sender, $a_m_subject, $a_m_message, $attachments));
         return true;
     } else {
         // send direct
         include_once "Services/Mail/classes/class.ilMimeMail.php";
         $mmail = new ilMimeMail();
         $mmail->autoCheck(false);
         $mmail->From($sender);
         $mmail->To($a_rcp_to);
         // Add installation name to subject
         $mmail->Subject($a_m_subject);
         $mmail->Body($a_m_message);
         if ($a_rcp_cc) {
             $mmail->Cc($a_rcp_cc);
         }
         if ($a_rcp_bcc) {
             $mmail->Bcc($a_rcp_bcc);
         }
         if (is_array($a_attachments)) {
             foreach ($a_attachments as $attachment) {
                 $mmail->Attach($this->mfile->getAbsolutePath($attachment));
             }
         }
         $mmail->Send();
     }
 }
Example #7
0
 /**
  * Define the subject line of the email
  * @param string subject any monoline string
  */
 function Subject($subject, $a_add_prefix = false)
 {
     if ($a_add_prefix) {
         // #9096
         include_once "Services/Mail/classes/class.ilMail.php";
         $prefix = ilMail::getSubjectPrefix();
         if (trim($prefix)) {
             $subject = trim($prefix) . " " . $subject;
         }
     }
     $this->xheaders['Subject'] = ilMimeMail::_mimeEncode(strtr($subject, "\r\n", " "));
 }
    public function send()
    {
        global $ilDB, $lng, $ilSetting;
        $is_message_enabled = $ilSetting->get("mail_notification_message");
        $res = $ilDB->queryF('SELECT mail.* FROM mail_options
						INNER JOIN mail ON mail.user_id = mail_options.user_id
						INNER JOIN mail_obj_data ON mail_obj_data.obj_id = mail.folder_id
						WHERE cronjob_notification = %s
						AND send_time >= %s
						AND m_status = %s', array('integer', 'timestamp', 'text'), array(1, date('Y-m-d H:i:s', time() - 60 * 60 * 24), 'unread'));
        $users = array();
        $user_id = 0;
        while ($row = $ilDB->fetchAssoc($res)) {
            if ($user_id == 0 || $row['user_id'] != $user_id) {
                $user_id = $row['user_id'];
            }
            $users[$user_id][] = $row;
        }
        foreach ($users as $user_id => $mail_data) {
            $this->initLanguage($user_id);
            $user_lang = $this->getLanguage() ? $this->getLanguage() : $lng;
            $this->initMail();
            $this->setRecipients($user_id);
            $this->setSubject($this->getLanguageText('mail_notification_subject'));
            $this->setBody(ilMail::getSalutation($user_id, $this->getLanguage()));
            $this->appendBody("\n\n");
            if (count($mail_data) == 1) {
                $this->appendBody(sprintf($user_lang->txt('mail_at_the_ilias_installation'), count($mail_data), ilUtil::_getHttpPath()));
            } else {
                $this->appendBody(sprintf($user_lang->txt('mails_at_the_ilias_installation'), count($mail_data), ilUtil::_getHttpPath()));
            }
            $this->appendBody("\n\n");
            $counter = 1;
            foreach ($mail_data as $mail) {
                $this->appendBody("----------------------------------------------------------------------------------------------");
                $this->appendBody("\n\n");
                $this->appendBody('#' . $counter . "\n\n");
                $this->appendBody($user_lang->txt('date') . ": " . $mail['send_time']);
                $this->appendBody("\n");
                if ($mail['sender_id'] == ANONYMOUS_USER_ID) {
                    $sender = ilMail::_getIliasMailerName();
                } else {
                    $sender = ilObjUser::_lookupLogin($mail['sender_id']);
                }
                $this->appendBody($user_lang->txt('sender') . ": " . $sender);
                $this->appendBody("\n");
                $this->appendBody($user_lang->txt('subject') . ": " . $mail['m_subject']);
                $this->appendBody("\n\n");
                if ($is_message_enabled == true) {
                    $this->appendBody($user_lang->txt('message') . ": " . $mail['m_message']);
                    $this->appendBody("\n\n");
                }
                ++$counter;
            }
            $this->appendBody("----------------------------------------------------------------------------------------------");
            $this->appendBody("\n\n");
            $this->appendBody($user_lang->txt('follow_link_to_read_mails') . " ");
            $this->appendBody("\n");
            $mailbox_link = ilUtil::_getHttpPath();
            $mailbox_link .= "/goto.php?target=mail&client_id=" . CLIENT_ID;
            $this->appendBody($mailbox_link);
            $this->appendBody("\n\n");
            $this->appendBody(ilMail::_getAutoGeneratedMessageString($this->getLanguage()));
            $this->appendBody(ilMail::_getInstallationSignature());
            $mmail = new ilMimeMail();
            $mmail->autoCheck(false);
            $mmail->From(ilMail::getIliasMailerAddress());
            $mmail->To(ilObjUser::_lookupEmail($user_id));
            $mmail->Subject($this->getSubject());
            $mmail->Body($this->getBody());
            $mmail->Send();
        }
    }
 public function __sendBill($bookings)
 {
     global $tpl, $ilSetting;
     $i = 0;
     include_once './Services/UICore/classes/class.ilTemplate.php';
     include_once './Services/Utilities/classes/class.ilUtil.php';
     include_once './Services/Payment/classes/class.ilPaymentSettings.php';
     include_once './Services/Payment/classes/class.ilPaymentShoppingCart.php';
     include_once 'Services/Mail/classes/class.ilMimeMail.php';
     //		$psc_obj = new ilPaymentShoppingCart($this->user_obj);
     $genSet = ilPaymentSettings::_getInstance();
     $currency = $genSet->get('currency_unit');
     //		$tpl = new ilTemplate('./Services/Payment/templates/default/tpl.pay_bill.html', true, true, true);
     $tpl = new ilTemplate('tpl.pay_bill.html', true, true, 'Services/Payment');
     if ($tpl->placeholderExists('HTTP_PATH')) {
         $http_path = ilUtil::_getHttpPath();
         $tpl->setVariable('HTTP_PATH', $http_path);
     }
     ilDatePresentation::setUseRelativeDates(false);
     $tpl->setVariable('DATE', utf8_decode(ilDatePresentation::formatDate(new ilDate($bookings['list'][$i]['order_date'], IL_CAL_UNIX))));
     $tpl->setVariable('TXT_CREDIT', utf8_decode($this->lng->txt('credit')));
     $tpl->setVariable('TXT_DAY_OF_SERVICE_PROVISION', $this->lng->txt('day_of_service_provision'));
     include_once './Services/Payment/classes/class.ilPayMethods.php';
     $str_paymethod = ilPayMethods::getStringByPaymethod($bookings['list'][$i]['b_pay_method']);
     if (strlen(trim($bookings['transaction_extern']))) {
         $tpl->setVariable('TXT_EXTERNAL_BILL_NO', str_replace('%s', $str_paymethod, utf8_decode($this->lng->txt('external_bill_no'))));
         $tpl->setVariable('EXTERNAL_BILL_NO', $bookings['transaction_extern']);
     }
     $tpl->setVariable('TXT_POSITION', $this->lng->txt('position'));
     $tpl->setVariable('TXT_AMOUNT', $this->lng->txt('amount'));
     $tpl->setVariable('TXT_UNIT_PRICE', utf8_decode($this->lng->txt('unit_price')));
     $tpl->setVariable('VENDOR_ADDRESS', nl2br(utf8_decode($genSet->get('address'))));
     $tpl->setVariable('VENDOR_ADD_INFO', nl2br(utf8_decode($genSet->get('add_info'))));
     $tpl->setVariable('VENDOR_BANK_DATA', nl2br(utf8_decode($genSet->get('bank_data'))));
     $tpl->setVariable('TXT_BANK_DATA', utf8_decode($this->lng->txt('pay_bank_data')));
     $tpl->setVariable('CUSTOMER_FIRSTNAME', utf8_decode($this->user_obj->getFirstname()));
     $tpl->setVariable('CUSTOMER_LASTNAME', utf8_decode($this->user_obj->getLastname()));
     if ($bookings['po_box'] == '') {
         $tpl->setVariable('CUSTOMER_STREET', utf8_decode($bookings['street']));
         // contains also housenumber
     } else {
         $tpl->setVariable('CUSTOMER_STREET', utf8_decode($bookings['po_box']));
     }
     $tpl->setVariable('CUSTOMER_ZIPCODE', utf8_decode($bookings['zipcode']));
     $tpl->setVariable('CUSTOMER_CITY', utf8_decode($bookings['city']));
     $tpl->setVariable('CUSTOMER_COUNTRY', utf8_decode($bookings['country']));
     $tpl->setVariable('BILL_NO', $bookings['transaction']);
     $tpl->setVariable('DATE', date('d.m.Y'));
     $tpl->setVariable('TXT_BILL', utf8_decode($this->lng->txt('pays_bill')));
     $tpl->setVariable('TXT_BILL_NO', utf8_decode($this->lng->txt('pay_bill_no')));
     $tpl->setVariable('TXT_DATE', utf8_decode($this->lng->txt('date')));
     $tpl->setVariable('TXT_ARTICLE', utf8_decode($this->lng->txt('pay_article')));
     $tpl->setVariable('TXT_VAT_RATE', utf8_decode($this->lng->txt('vat_rate')));
     $tpl->setVariable('TXT_VAT_UNIT', utf8_decode($this->lng->txt('vat_unit')));
     $tpl->setVariable('TXT_PRICE', utf8_decode($this->lng->txt('price_a')));
     for ($i = 0; $i < count($bookings['list']); $i++) {
         $tmp_pobject = new ilPaymentObject($this->user_obj, $bookings['list'][$i]['pobject_id']);
         $assigned_coupons = '';
         if (!empty($_SESSION['coupons'][$this->session_var])) {
             foreach ($_SESSION['coupons'][$this->session_var] as $coupon) {
                 $this->coupon_obj->setId($coupon['pc_pk']);
                 $this->coupon_obj->setCurrentCoupon($coupon);
                 if ($this->coupon_obj->isObjectAssignedToCoupon($tmp_pobject->getRefId())) {
                     $assigned_coupons .= '<br />' . $this->lng->txt('paya_coupons_coupon') . ': ' . $coupon['pcc_code'];
                 }
             }
         }
         $tpl->setCurrentBlock('loop');
         $tpl->setVariable('LOOP_POSITION', $i + 1);
         $tpl->setVariable('LOOP_AMOUNT', '1');
         $tpl->setVariable('LOOP_TXT_PERIOD_OF_SERVICE_PROVISION', utf8_decode($this->lng->txt('period_of_service_provision')));
         $tpl->setVariable('LOOP_OBJ_TYPE', utf8_decode($this->lng->txt($bookings['list'][$i]['type'])));
         $tpl->setVariable('LOOP_TITLE', $tmp = utf8_decode($bookings['list'][$i]['title']));
         $tpl->setVariable('LOOP_COUPON', utf8_decode($assigned_coupons));
         $tpl->setVariable('LOOP_TXT_ENTITLED_RETRIEVE', utf8_decode($this->lng->txt('pay_entitled_retrieve')));
         if ($bookings['list'][$i]['duration'] == 0 && $bookings['list'][$i]['access_enddate'] == NULL) {
             $tpl->setVariable('LOOP_DURATION', utf8_decode($this->lng->txt('unlimited_duration')));
         } else {
             $access_startdate = utf8_decode(ilDatePresentation::formatDate(new ilDate($bookings['list'][$i]['access_startdate'], IL_CAL_DATE)));
             $access_enddate = utf8_decode(ilDatePresentation::formatDate(new ilDate($bookings['list'][$i]['access_enddate'], IL_CAL_DATE)));
             $tmp_duration = $access_startdate . ' - ' . $access_enddate;
             if ($bookings['list'][$i]['duration'] > 0) {
                 $tmp_duration .= ' /  ' . $bookings['list'][$i]['duration'] . ' ' . utf8_decode($this->lng->txt('paya_months'));
             }
             $tpl->setVariable('LOOP_DURATION', $tmp_duration);
         }
         #$currency = $bookings['list'][$i]['currency_unit'];
         $tpl->setVariable('LOOP_VAT_RATE', number_format($bookings['list'][$i]['vat_rate'], 2, ',', '.') . ' %');
         $tpl->setVariable('LOOP_VAT_UNIT', number_format($bookings['list'][$i]['vat_unit'], 2, ',', '.') . ' ' . $currency);
         $tpl->setVariable('LOOP_PRICE', number_format($bookings['list'][$i]['price'], 2, ',', '.') . ' ' . $currency);
         $tpl->setVariable('LOOP_UNIT_PRICE', number_format($bookings['list'][$i]['price'], 2, ',', '.') . ' ' . $currency);
         $tpl->parseCurrentBlock('loop');
         $bookings['total'] += (double) $bookings[$i]['price'];
         $bookings['total_vat'] += (double) $bookings[$i]['vat_unit'];
         #$bookings['total_discount'] +=(float) $bookings[$i]['discount'];
         unset($tmp_pobject);
         $sub_total_amount = $bookings['total'];
     }
     $bookings['total'] += $bookings['total_discount'];
     if ($bookings['total_discount'] < 0) {
         $tpl->setCurrentBlock('cloop');
         $tpl->setVariable('TXT_SUBTOTAL_AMOUNT', utf8_decode($this->lng->txt('pay_bmf_subtotal_amount')));
         $tpl->setVariable('SUBTOTAL_AMOUNT', number_format($sub_total_amount, 2, ',', '.') . ' ' . $currency);
         $tpl->setVariable('TXT_COUPON', utf8_decode($this->lng->txt('paya_coupons_coupon')));
         $tpl->setVariable('BONUS', number_format($bookings['total_discount'], 2, ',', '.') . ' ' . $currency);
         $tpl->parseCurrentBlock();
     }
     if ($bookings['total'] < 0) {
         $bookings['total'] = 0.0;
         //	$bookings['total_vat'] = 0.0;
     }
     $total_net_price = $sub_total_amount - $bookings['total_vat'];
     $tpl->setVariable('TXT_TOTAL_NETPRICE', utf8_decode($this->lng->txt('total_netprice')));
     $tpl->setVariable('TOTAL_NETPRICE', number_format($total_net_price, 2, ',', '.') . ' ' . $currency);
     $tpl->setVariable('TXT_TOTAL_AMOUNT', utf8_decode($this->lng->txt('pay_bmf_total_amount')));
     $tpl->setVariable('TOTAL_AMOUNT', number_format($bookings['total'], 2, ',', '.') . ' ' . $currency);
     if ($bookings['total_vat'] > 0) {
         $tpl->setVariable('TOTAL_VAT', number_format($bookings['total_vat'], 2, ',', '.') . ' ' . $currency);
         $tpl->setVariable('TXT_TOTAL_VAT', utf8_decode($this->lng->txt('plus_vat')));
     }
     if (1 == $bookings['list'][0]['b_pay_method']) {
         $tpl->setVariable('TXT_PAYMENT_TYPE', utf8_decode($this->lng->txt('pay_unpayed_bill')));
     } else {
         $tpl->setVariable('TXT_PAYMENT_TYPE', utf8_decode($this->lng->txt('pay_payed_bill')));
     }
     if (!@file_exists($genSet->get('pdf_path'))) {
         ilUtil::makeDir($genSet->get('pdf_path'));
     }
     $file_name = time();
     if (@file_exists($genSet->get('pdf_path'))) {
         ilUtil::html2pdf($tpl->get(), $genSet->get('pdf_path') . '/' . $file_name . '.pdf');
     }
     if (@file_exists($genSet->get('pdf_path') . '/' . $file_name . '.pdf') && $this->user_obj->getEmail() != '' && $ilSetting->get('admin_email') != '') {
         $m = new ilMimeMail();
         // create the mail
         $m->From($ilSetting->get('admin_email'));
         $m->To($this->user_obj->getEmail());
         $m->Subject($this->lng->txt('pay_message_subject'));
         // if there is no mailbillingtext use this as standard
         $message = $this->lng->txt('pay_message_hello') . ' ' . $this->user_obj->getFirstname() . ' ' . $this->user_obj->getLastname() . ",\n\n";
         $message .= $this->lng->txt('pay_message_thanks') . "\n\n";
         $message .= $this->lng->txt('pay_message_attachment') . "\n\n";
         $message .= $this->lng->txt('pay_message_regards') . "\n\n";
         $message .= strip_tags($genSet->get('address'));
         //replacePlaceholders...
         $billing_text = $genSet->getMailBillingText();
         if (!$billing_text) {
             $message = '';
         }
         if ($genSet->getMailUsePlaceholders() == 1) {
             include_once './Services/Payment/classes/class.ilBillingMailPlaceholdersPropertyGUI.php';
             $message = ilBillingMailPlaceholdersPropertyGUI::replaceBillingMailPlaceholders($billing_text, $this->user_obj->getId());
         }
         $m->Body($message);
         // set the body
         $m->Attach($genSet->get('pdf_path') . '/' . $file_name . '.pdf', 'application/pdf');
         // attach a file of type image/gif
         if ($genSet->get('attach_sr_invoice') == 1) {
             require_once 'Services/RTE/classes/class.ilRTE.php';
             $regulations = ilRTE::_replaceMediaObjectImageSrc($genSet->get('statutory_regulations'), 1);
             $reg_file_name = 'statutory_regulations';
             if (@file_exists($genSet->get('pdf_path'))) {
                 ilUtil::html2pdf($regulations, $genSet->get('pdf_path') . '/' . $reg_file_name . '.pdf');
             }
             $m->Attach($genSet->get('pdf_path') . '/' . $reg_file_name . '.pdf', 'application/pdf');
             // attach a file of type image/gif
         }
         $m->Send();
         // send the mail
     }
     @unlink($genSet->get('pdf_path') . '/' . $file_name . '.html');
     @unlink($genSet->get('pdf_path') . '/' . $file_name . '.pdf');
     unset($current_booking_id);
     unset($pobject);
     unset($_SESSION['coupons'][$this->session_var]);
     $this->ctrl->redirectByClass('ilShopBoughtObjectsGUI', '');
 }
 protected function __distributeMails($password, $a_language = null)
 {
     global $ilSetting;
     include_once './Services/Language/classes/class.ilLanguage.php';
     include_once './Services/User/classes/class.ilObjUser.php';
     include_once "Services/Mail/classes/class.ilFormatMail.php";
     include_once './Services/Registration/classes/class.ilRegistrationMailNotification.php';
     // Always send mail to approvers
     if ($this->registration_settings->getRegistrationType() == IL_REG_APPROVE && !$this->code_was_used) {
         $mail = new ilRegistrationMailNotification();
         $mail->setType(ilRegistrationMailNotification::TYPE_NOTIFICATION_CONFIRMATION);
         $mail->setRecipients($this->registration_settings->getApproveRecipients());
         $mail->setAdditionalInformation(array('usr' => $this->userObj));
         $mail->send();
     } else {
         $mail = new ilRegistrationMailNotification();
         $mail->setType(ilRegistrationMailNotification::TYPE_NOTIFICATION_APPROVERS);
         $mail->setRecipients($this->registration_settings->getApproveRecipients());
         $mail->setAdditionalInformation(array('usr' => $this->userObj));
         $mail->send();
     }
     // Send mail to new user
     // Registration with confirmation link ist enabled
     if ($this->registration_settings->getRegistrationType() == IL_REG_ACTIVATION && !$this->code_was_used) {
         include_once './Services/Registration/classes/class.ilRegistrationMimeMailNotification.php';
         $mail = new ilRegistrationMimeMailNotification();
         $mail->setType(ilRegistrationMimeMailNotification::TYPE_NOTIFICATION_ACTIVATION);
         $mail->setRecipients(array($this->userObj));
         $mail->setAdditionalInformation(array('usr' => $this->userObj, 'hash_lifetime' => $this->registration_settings->getRegistrationHashLifetime()));
         $mail->send();
     } else {
         // try individual account mail in user administration
         include_once "Services/Mail/classes/class.ilAccountMail.php";
         include_once './Services/User/classes/class.ilObjUserFolder.php';
         $amail = ilObjUserFolder::_lookupNewAccountMail($a_language);
         if (trim($amail["body"]) == "" || trim($amail["subject"]) == "") {
             $amail = ilObjUserFolder::_lookupNewAccountMail($GLOBALS["lng"]->getDefaultLanguage());
         }
         if (trim($amail["body"]) != "" && trim($amail["subject"]) != "") {
             $acc_mail = new ilAccountMail();
             $acc_mail->setUser($this->userObj);
             if ($this->registration_settings->passwordGenerationEnabled()) {
                 $acc_mail->setUserPassword($password);
             }
             if ($amail["att_file"]) {
                 include_once "Services/User/classes/class.ilFSStorageUserFolder.php";
                 $fs = new ilFSStorageUserFolder(USER_FOLDER_ID);
                 $fs->create();
                 $path = $fs->getAbsolutePath() . "/";
                 $acc_mail->addAttachment($path . "/" . $amail["lang"], $amail["att_file"]);
             }
             $acc_mail->send();
         } else {
             include_once "Services/Mail/classes/class.ilMimeMail.php";
             $mmail = new ilMimeMail();
             $mmail->autoCheck(false);
             $mmail->From($ilSetting->get("admin_email"));
             $mmail->To($this->userObj->getEmail());
             // mail subject
             $subject = $this->lng->txt("reg_mail_subject");
             // mail body
             $body = $this->lng->txt("reg_mail_body_salutation") . " " . $this->userObj->getFullname() . ",\n\n" . $this->lng->txt("reg_mail_body_text1") . "\n\n" . $this->lng->txt("reg_mail_body_text2") . "\n" . ILIAS_HTTP_PATH . "/login.php?client_id=" . CLIENT_ID . "\n";
             $body .= $this->lng->txt("login") . ": " . $this->userObj->getLogin() . "\n";
             if ($this->registration_settings->passwordGenerationEnabled()) {
                 $body .= $this->lng->txt("passwd") . ": " . $password . "\n";
             }
             $body .= "\n";
             // Info about necessary approvement
             if ($this->registration_settings->getRegistrationType() == IL_REG_APPROVE && !$this->code_was_used) {
                 $body .= $this->lng->txt('reg_mail_body_pwd_generation') . "\n\n";
             }
             $body .= $this->lng->txt("reg_mail_body_text3") . "\n\r";
             $body .= $this->userObj->getProfileAsString($this->lng);
             $mmail->Subject($subject);
             $mmail->Body($body);
             $mmail->Send();
         }
     }
 }
 /** Creates (or reuses) a password assistance session, and sends a password
  * assistance mail to the specified user.
  * 
  * Note: To prevent DOS attacks, a new session is created only, if no session
  * exists, or if the existing session has been expired.
  *
  * The password assistance mail contains an URL, which points to this script
  * and contains the following URL parameters:
  * client_id
  * key
  *
  * @param usrObj An instance of class.ilObjUserObject.php.
  */
 function sendUsernameAssistanceMail($email, $logins)
 {
     global $lng, $ilias;
     include_once "Services/Mail/classes/class.ilMailbox.php";
     include_once "Services/Mail/classes/class.ilMimeMail.php";
     require_once "include/inc.pwassist_session_handler.php";
     $protocol = isset($_SERVER['HTTPS']) ? "https://" : "http://";
     // Compose the mail
     $server_url = $protocol . $_SERVER['HTTP_HOST'] . substr($_SERVER['PHP_SELF'], 0, strrpos($_SERVER['PHP_SELF'], '/')) . '/';
     $login_url = $server_url . "pwassist.php" . "?client_id=" . $ilias->getClientId() . "&lang=" . $lng->getLangKey();
     //echo "-".htmlentities($login_url)."-";
     $contact_address = $ilias->getSetting("admin_email");
     $mm = new ilMimeMail();
     $mm->Subject($lng->txt("pwassist_mail_subject"));
     $mm->From($contact_address);
     $mm->To($email);
     $mm->Body(str_replace(array("\\n", "\\t"), array("\n", "\t"), sprintf($lng->txt("pwassist_username_mail_body"), join($logins, ",\n"), $server_url, $_SERVER['REMOTE_ADDR'], $email, 'mailto:' . $contact_address, $login_url)));
     $mm->Send();
 }
 /**
  * Sends the mail with its object properties as MimeMail
  * It first tries to read the mail body, subject and sender address from posted named formular fields. 
  * If no field values found the defaults are used.
  * Placehoders will be replaced by the appropriate data.
  * @access	public
  * @param object ilUser
  */
 function send()
 {
     global $ilSetting;
     // determine language and get account mail data
     // fall back to default language if acccount mail data is not given for user language.
     $amail = $this->readMailTemplate($this->data['language']);
     if ($amail['body'] == '' || $amail['subject'] == '') {
         $amail = $this->readMailTemplate($ilSetting->get('language'));
         $lang = $ilSetting->get('language');
     } else {
         $lang = $this->data['language'];
     }
     // fallback if mail data is still not given
     if ($this->areLangVariablesUsedAsFallback() && ($amail['body'] == '' || $amail['subject'] == '')) {
         $lang = $this->data['language'];
         $tmp_lang = $this->getLng($lang);
         // mail subject
         $mail_subject = $tmp_lang->txt('disk_quota_mail_subject');
         // mail body
         $mail_body = $tmp_lang->txt('disk_quota_mail_body_salutation') . ' ' . $data['firstname'] . ' ' . $data['lastname'] . ",\n\n" . $tmp_lang->txt('disk_quota_body_text1') . "\n\n" . $tmp_lang->txt('disk_quota_body_text2') . "\n" . ILIAS_HTTP_PATH . '/login.php?client_id=' . CLIENT_ID . "\n";
         $mail_body .= $tmp_lang->txt('login') . ': ' . $data['firstname'] . "\n";
         $mail_body .= "\n";
         $mail_body .= $tmp_lang->txt('disk_quota_mail_body_text3') . "\n\r";
         //$mail_body .= $user->getProfileAsString($tmp_lang);
     } else {
         // replace placeholders
         $mail_subject = $this->replacePlaceholders($amail['subject'], $amail, $lang);
         $mail_body = $this->replacePlaceholders($amail['body'], $amail, $lang);
     }
     // send the mail
     include_once 'Services/Mail/classes/class.ilMimeMail.php';
     $mmail = new ilMimeMail();
     $mmail->autoCheck(false);
     $mmail->From($ilSetting->get('admin_email'));
     $mmail->Subject($mail_subject);
     $mmail->To($this->data['email']);
     $mmail->Body($mail_body);
     $mmail->Send();
     include_once 'Services/Mail/classes/class.ilMail.php';
     $mail = new ilMail($_SESSION["AccountId"]);
     $mail->sendMail($this->data['login'], "", "", $mail_subject, $mail_body, array(), array("normal"));
     return true;
 }
 /**
  * Creates (or reuses) a password assistance session, and sends a password
  * assistance mail to the specified user.
  * Note: To prevent DOS attacks, a new session is created only, if no session
  * exists, or if the existing session has been expired.
  * The password assistance mail contains an URL, which points to this script
  * and contains the following URL parameters:
  * client_id
  * key
  * @param $email
  * @param $logins
  */
 public function sendUsernameAssistanceMail($email, array $logins)
 {
     require_once 'Services/Mail/classes/class.ilMailbox.php';
     require_once 'Services/Mail/classes/class.ilMimeMail.php';
     require_once 'include/inc.pwassist_session_handler.php';
     $protocol = $this->https->isDetected() ? 'https://' : 'http://';
     $server_url = $protocol . $_SERVER['HTTP_HOST'] . substr($_SERVER['PHP_SELF'], 0, strrpos($_SERVER['PHP_SELF'], '/')) . '/';
     $login_url = $server_url . 'pwassist.php' . '?client_id=' . $this->ilias->getClientId() . '&lang=' . $this->lng->getLangKey();
     $contact_address = $this->settings->get('admin_email');
     $mm = new ilMimeMail();
     $mm->Subject($this->lng->txt('pwassist_mail_subject'));
     $mm->From($contact_address);
     $mm->To($email);
     $mm->Body(str_replace(array("\\n", "\\t"), array("\n", "\t"), sprintf($this->lng->txt('pwassist_username_mail_body'), join($logins, ",\n"), $server_url, $_SERVER['REMOTE_ADDR'], $email, 'mailto:' . $contact_address, $login_url)));
     $mm->Send();
 }
Example #14
0
 /**
  * Sends the mail with its object properties as MimeMail
  * It first tries to read the mail body, subject and sender address from posted named formular fields. 
  * If no field values found the defaults are used.
  * Placehoders will be replaced by the appropriate data.
  * @access	public
  * @param object ilUser
  */
 function send()
 {
     global $ilSetting;
     $user =& $this->getUser();
     if (!$user->getEmail()) {
         return false;
     }
     // determine language and get account mail data
     // fall back to default language if acccount mail data is not given for user language.
     $amail = $this->readAccountMail($user->getLanguage());
     if ($amail['body'] == '' || $amail['subject'] == '') {
         $amail = $this->readAccountMail($ilSetting->get('language'));
         $lang = $ilSetting->get('language');
     } else {
         $lang = $user->getLanguage();
     }
     // fallback if mail data is still not given
     if ($this->areLangVariablesUsedAsFallback() && ($amail['body'] == '' || $amail['subject'] == '')) {
         $lang = $user->getLanguage();
         $tmp_lang = new ilLanguage($lang);
         // mail subject
         $mail_subject = $tmp_lang->txt('reg_mail_subject');
         $timelimit = "";
         if (!$user->checkTimeLimit()) {
             $tmp_lang->loadLanguageModule("registration");
             // #6098
             $timelimit_from = new ilDateTime($user->getTimeLimitFrom(), IL_CAL_UNIX);
             $timelimit_until = new ilDateTime($user->getTimeLimitUntil(), IL_CAL_UNIX);
             $timelimit = ilDatePresentation::formatPeriod($timelimit_from, $timelimit_until);
             $timelimit = "\n" . sprintf($tmp_lang->txt('reg_mail_body_timelimit'), $timelimit) . "\n\n";
         }
         // mail body
         $mail_body = $tmp_lang->txt('reg_mail_body_salutation') . ' ' . $user->getFullname() . ",\n\n" . $tmp_lang->txt('reg_mail_body_text1') . "\n\n" . $tmp_lang->txt('reg_mail_body_text2') . "\n" . ILIAS_HTTP_PATH . '/login.php?client_id=' . CLIENT_ID . "\n";
         $mail_body .= $tmp_lang->txt('login') . ': ' . $user->getLogin() . "\n";
         $mail_body .= $tmp_lang->txt('passwd') . ': ' . $this->u_password . "\n";
         $mail_body .= "\n" . $timelimit;
         $mail_body .= $tmp_lang->txt('reg_mail_body_text3') . "\n\r";
         $mail_body .= $user->getProfileAsString($tmp_lang);
     } else {
         // replace placeholders
         $mail_subject = $this->replacePlaceholders($amail['subject'], $user, $amail, $lang);
         $mail_body = $this->replacePlaceholders($amail['body'], $user, $amail, $lang);
     }
     // send the mail
     include_once 'Services/Mail/classes/class.ilMimeMail.php';
     $mmail = new ilMimeMail();
     $mmail->autoCheck(false);
     $mmail->From($ilSetting->get('admin_email'));
     $mmail->Subject($mail_subject);
     $mmail->To($user->getEmail());
     $mmail->Body($mail_body);
     foreach ($this->attachments as $filename => $display_name) {
         $mmail->Attach($filename, "", "attachment", $display_name);
     }
     /*
     echo "<br><br><b>From</b>:".$ilSetting->get("admin_email");
     echo "<br><br><b>To</b>:".$user->getEmail();
     echo "<br><br><b>Subject</b>:".$mail_subject;
     echo "<br><br><b>Body</b>:".$mail_body;
     return true;*/
     $mmail->Send();
     return true;
 }
Example #15
0
 function __sendProfileMail()
 {
     global $ilUser, $ilias;
     if ($_POST['send_mail'] != 'y') {
         return '';
     }
     if (!strlen($this->object->getEmail())) {
         return '';
     }
     // Choose language of user
     $usr_lang = new ilLanguage($this->object->getLanguage());
     $usr_lang->loadLanguageModule('crs');
     $usr_lang->loadLanguageModule('registration');
     include_once "Services/Mail/classes/class.ilMimeMail.php";
     $mmail = new ilMimeMail();
     $mmail->autoCheck(false);
     $mmail->From($ilUser->getEmail());
     $mmail->To($this->object->getEmail());
     // mail subject
     $subject = $usr_lang->txt("profile_changed");
     // mail body
     $body = $usr_lang->txt("reg_mail_body_salutation") . " " . $this->object->getFullname() . ",\n\n";
     $date = $this->object->getApproveDate();
     // Approve
     if (time() - strtotime($date) < 10) {
         $body .= $usr_lang->txt('reg_mail_body_approve') . "\n\n";
     } else {
         $body .= $usr_lang->txt('reg_mail_body_profile_changed') . "\n\n";
     }
     // Append login info only if password has been chacnged
     if ($_POST['passwd'] != '********') {
         $body .= $usr_lang->txt("reg_mail_body_text2") . "\n" . ILIAS_HTTP_PATH . "/login.php?client_id=" . $ilias->client_id . "\n" . $usr_lang->txt("login") . ": " . $this->object->getLogin() . "\n" . $usr_lang->txt("passwd") . ": " . $_POST['passwd'] . "\n\n";
     }
     $body .= $usr_lang->txt("reg_mail_body_text3") . "\n";
     $body .= $this->object->getProfileAsString($usr_lang);
     $mmail->Subject($subject);
     $mmail->Body($body);
     $mmail->Send();
     return "<br/>" . $this->lng->txt("mail_sent");
 }
 /**
  * Define the subject line of the email
  * @param string subject any monoline string
  */
 function Subject($subject)
 {
     $this->xheaders['Subject'] = ilMimeMail::_mimeEncode(strtr($subject, "\r\n", " "));
 }