$message_ha["testo"] .= "\n\r" . translateFN("Buono studio!");
             $message_ha["testo"] .= "\n\r" . translateFN("La segreteria dei Corsi di Lingua Italiana ICoN");
             $message_ha["testo"] .= "\n\r\n\r --------\r\n" . translateFN('Dettagli di pagamento.');
             $message_ha["testo"] .= "\r\n" . translateFN('Nome e cognome:') . " " . $firstname . " " . $lastname;
             $message_ha["testo"] .= "\r\n" . translateFN('Username:'******'Importo:') . " " . $payment_currency . " " . $payment_amount;
             $message_ha["testo"] .= "\r\n" . translateFN('Iscrizione al corso:') . " " . $course_name;
             $message_ha["testo"] .= "\r\n" . translateFN('ID della transazione:') . " " . $txn_id;
             $message_ha["testo"] .= "\r\n --------\r\n";
             //                    $message_ha["testo"] .= "\n\r\n\r". "------------------";
             if ($debug == 1) {
                 fwrite($fpx, "Inviata mail a {$payer_email}\n");
             }
         }
         $mailer = new Mailer();
         $res = $mailer->send_mail($message_ha, $sender_email, $recipients_emails_ar);
     } else {
         $message = translateFN('Gentile') . " " . $firstname . ", <BR />";
         $message .= translateFN('il corso pagato non corrisponde ai dettagli in nostro possesso') . "<BR />";
         $message .= translateFN('se hai bisogno di maggiori informazioni scrivi una mail a:') . " " . ADA_ADMIN_MAIL_ADDRESS;
         $ipn_log .= "Purchase does not match product details\n";
         if ($debug == 1) {
             fwrite($fpx, "Purchase does not match product details\n");
         }
     }
 } else {
     if (strcmp($res, "INVALID") == 0) {
         /*
                        $message = translateFN('Gentile') . " " . $firstname .", <BR />";
                        $message .= translateFN('Non è possibile verificare il tuo acquisto')."<BR />";
                        $message .= translateFN('Forse provando più tardi riuscirai ad acquistare il corso.');
    $management_body_mail .= translateFN('Codice Fiscale') . ': ' . $fiscalCode . PHP_EOL;
    $management_body_mail .= translateFN('Indirizzo') . ': ' . $userAddress . PHP_EOL;
    $management_body_mail .= translateFN('Città') . ': ' . $userCity . PHP_EOL;
    $management_body_mail .= translateFN('Provincia') . ': ' . $userProvince . PHP_EOL;
    $management_body_mail .= translateFN('Nazione') . ': ' . $userCountry . PHP_EOL;
    $management_body_mail .= translateFN('Telefono') . ': ' . $userPhone . PHP_EOL;
    $management_body_mail .= '------------' . PHP_EOL;
    $management_message_ha["titolo"] = $management_subject;
    $management_message_ha["testo"] = $management_body_mail;
    $management_mailer = new Mailer();
    $res = $management_mailer->send_mail($management_message_ha, $management_sender_email, $management_recipients_emails_ar);
    /*
     * mail to user
     */
    $user_mail_body = str_replace('<br />', PHP_EOL, $message);
    $user_mail_body .= translateFN('Per ulteriori informazioni scrivi a') . ': ' . PAYPAL_ADMIN_MAIL;
    $user_mail_subject = $management_subject;
    $user_recipients_emails_ar = array($userEmail);
    $user_message_ha["titolo"] = $user_mail_subject;
    $user_message_ha["testo"] = $user_mail_body;
    $user_mailer = new Mailer();
    $res = $user_mailer->send_mail($user_message_ha, $management_sender_email, $user_recipients_emails_ar);
    $field_data = array('menu' => "", 'banner' => $banner, 'path' => $path, 'data' => $info_div->getHtml(), 'help' => '', 'user_name' => $user_name, 'user_type' => $user_type, 'messages' => $user_messages->getHtml(), 'agenda' => $user_agenda->getHtml(), 'titolo_corso' => $course_name, 'annulla_iscrizione' => $link_annulla_iscrizione, 'price' => $price);
} else {
    $dati = translateFN('Impossibile proseguire, Provider non trovato');
    $field_data = array('menu' => "", 'banner' => $banner, 'data' => $dati, 'help' => '', 'user_name' => $user_name, 'user_type' => $user_type, 'messages' => $user_messages->getHtml(), 'agenda' => $user_agenda->getHtml(), 'titolo_corso' => $course_name, 'annulla_iscrizione' => $link_annulla_iscrizione, 'price' => $price);
}
/**
 * Sends data to the rendering engine
 */
ARE::render($layout_dataAr, $field_data);
Esempio n. 3
0
 /**
  * send a message of a given type to one or more recipients
  *
  * @access public
  *
  * @param   $message_ha - contains all data of message to send
  *                        this also means the recipients list
  *                        the parameter is an hash whose keys are:
  *                        data_ora,
  *                        tipo,
  *                        titolo,
  *                        mittente*,
  *                        destinatari**,
  *                        priorita,
  *                        testo
  *
  *                        *mittente is a username
  *                       **destinatari is a CVS list of usernames
  *
  * @return    an AMA_Error object if something goes wrong
  *
  **/
 public function send_message($message_ha)
 {
     $root_dir = $GLOBALS['root_dir'];
     // logger("MessageHandler::send_message entered", 2);
     // need to include this to use find_users_list
     //include_once("$root_dir/comunica/include/UserDataHandler.inc.php");
     // create instance of UserDataHandler
     //vito, 26 settembre 2008
     //$udh = new UserDataHandler();
     $udh = UserDataHandler::instance($this->dsn);
     // exctract type
     $type = $message_ha['tipo'];
     // extract sender name
     $sender = $message_ha['mittente'];
     // Modified by Stamatios Filippis. 19/01/2005
     // we have the interest to extract and define the recipients field in all cases
     // except the case that the message is a common chat message.in that case we do not need
     // the recipients field since we do not have to access the destinatari_messaggi table
     if ($type != ADA_MSG_CHAT) {
         // extract recipient_list
         if (is_array($message_ha['destinatari'])) {
             $recipients_ar = $message_ha['destinatari'];
         } else {
             $recipients_ar = explode(",", $message_ha['destinatari']);
         }
         foreach ($recipients_ar as $recipient) {
             $new_recipients_ar[] = "'" . trim($recipient) . "'";
         }
         // vito 14 gennaio 2009 aggiunto > 1
         if (count($new_recipients_ar) > 1) {
             $recipients_list = implode(",", $new_recipients_ar);
             $clause = "username in ({$recipients_list})";
         } else {
             $recipient_list = $new_recipients_ar[0];
             // vito 14 gennaio 2009, rimossi ' ' intorno a $recipient_list
             $clause = "username = {$recipient_list}";
         }
         // logger("recipients_list: $recipients_list", 4);
         // get the list of e-mail addresses of the recipients
         $res_ar = $udh->find_users_list(array("e_mail"), $clause);
         // echo "array: " . (!is_array($res_ar)) . "!";
         if (AMA_DataHandler::isError($res_ar) or !is_array($res_ar)) {
             // echo "array: " . (!is_array($res_ar));
             return new AMA_Error(AMA_ERR_SEND_MSG);
         }
         // transform bidim array into linear array of ids and emails
         // logger("recipients:", 4);
         foreach ($res_ar as $user) {
             $recipients_ids_ar[] = $user[0];
             $recipients_emails_ar[] = $user[1];
             // logger("id: ".$user[0]." email: ".$user[1], 4);
         }
     }
     // end of exctracting recipients
     // get the sender's ID and email address
     $res_ar = $udh->find_users_list(array("e_mail"), "username='******'");
     if (AMA_DataHandler::isError($res_ar) || !is_array($res_ar) || count($res_ar) <= 0) {
         return new AMA_Error(AMA_ERR_SEND_MSG);
     }
     $sender_id = $res_ar[0][0];
     $sender_email = $res_ar[0][1];
     // handle the mail case in a different way
     // we want to use SimpleSpool even if user selected e-mail type
     if ($type == ADA_MSG_MAIL || $type == ADA_MSG_MAIL_ONLY) {
         // delegate sending the e-mail to the mailer
         $mailer = new Mailer();
         $res = $mailer->send_mail($message_ha, $sender_email, $recipients_emails_ar);
         if (AMA_DataHandler::isError($res)) {
             //  return $res; ???
             return new AMA_Error(AMA_ERR_SEND_MSG);
         }
         if ($type == ADA_MSG_MAIL_ONLY) {
             return $res;
         } else {
             // continue...
             $spool = new SimpleSpool($sender_id, $this->dsn);
         }
     } else {
         switch ($type) {
             case ADA_MSG_SIMPLE:
                 // select the appropriate spool
                 $spool = new SimpleSpool($sender_id, $this->dsn);
                 break;
             case ADA_MSG_AGENDA:
                 // select the appropriate spool
                 $spool = new AgendaSpool($sender_id, $this->dsn);
                 break;
                 // Modified by Stamatios Filippis. 19/01/2005
             // Modified by Stamatios Filippis. 19/01/2005
             case ADA_MSG_CHAT:
                 // select the appropriate spool
                 $spool = new ChatSpool($sender_id, $type, NULL, $this->dsn);
                 break;
                 // Modified by Stamatios Filippis. 19/01/2005
             // Modified by Stamatios Filippis. 19/01/2005
             case ADA_MSG_PRV_CHAT:
                 // select the appropriate spool
                 $spool = new ChatSpool($sender_id, $type, NULL, $this->dsn);
                 break;
         }
         // end of switch
     }
     // Modified by Stamatios Filippis. 19/01/2005
     // Common chat message, no need to access destinatari_messaggi table.
     if ($type == ADA_MSG_CHAT) {
         // add the message to the spool
         $res = $spool->add_message($message_ha);
         if (AMA_DataHandler::isError($res)) {
             return $res;
             // return new AMA_Error(AMA_ERR_SEND_MSG);
         }
         // logger("Message successfully sent", 2);
         return $res;
     } else {
         // we have to verify that the field $recipients it is not empty
         if (!isset($recipients_ids_ar)) {
             return new AMA_Error(AMA_ERR_SEND_MSG);
         }
         // add the message to the spool
         // e se non è inizializzato?
         $res = $spool->add_message($message_ha, $recipients_ids_ar);
         if (AMA_DataHandler::isError($res)) {
             //             echo "spooler error (type $type)";
             return $res;
             //return new AMA_Error(AMA_ERR_SEND_MSG);
         }
         // logger("Message successfully sent", 2);
         return $res;
     }
 }
Esempio n. 4
0
 public function send_activation_email()
 {
     $tags_mail = [':/name', ':/link'];
     //modify link with constant !!! Not final version!
     $link = 'http://tinyshopv2/account_activations/' . $user->activation_digest . '/edit/' . StringHelper::base64_url_encode($user->email);
     $replace_mail = [$this->name, $link];
     //modify path for file with constant !!! Not final version!
     $mail_html = str_replace($tags_mail, $replace_mail, file_get_contents('../app/views/mailer/activation_mail.php'));
     Mailer::send_mail($this->email, $this->name, 'Activation email', $mail_html);
 }
Esempio n. 5
0
<td>Judul: </td>
<td><input type="text" name="judul" size="40"/></td>
</tr>
<tr>
<td>Pesan: </td>
<td>&nbsp;</td></tr>
<tr>
<td colspan="2"><textarea cols="58" rows="10" name="pesan"></textarea></td></tr>
<tr>
<td>&nbsp;</td>
<td><input type="submit" name="Send" value="Send"/><input type="reset" name="reset" value="Cancel"/></td>
</tr>
</table>
</form>

<?php 
include "Mailer.class.php";
if (isset($_POST['Send'])) {
    $pengirim = $_POST['pengirim'];
    $penerima = $_POST['penerima'];
    $judul = $_POST['judul'];
    $pesan = $_POST['pesan'];
    if ($pengirim == '') {
        die("Pengirim harus diisi");
    }
    $mailer = new Mailer($pengirim, $penerima, $judul, $pesan);
    $mailer->send_mail();
}
?>
</body>
</html>