Platon Technologies
neprihlásený Prihlásiť Registrácia
SlovakEnglish
open source software development oslavujeme 10 rokov vývoja otvoreného softvéru! Sobota, 28. november 2026
O nás
Magazín
Otvorený softvér
CVS
Služby
Index  »  Projekty  »  phpMyEdit  »  Fórum  »  Send a notify email to new user with username and password

phpMyEdit Features     Send a notify email to new user with username and password
Odoslať novú tému   Odpovedať na tému    
 
smokinpuppy     Založený: 26.03.2012   Príspevky: 14  
Príspevok Zaslal: 2012-06-17 09:49
Návrat hore  Odpovedať s citátom     

Hi,

I would like to be able to send a notification email to a new user when they are added and then if their record is changed I would like to send another notification with the new info. I know that other people have posted this, but the password field is encrypted when it is inserted into the database, so if I send them the email the password would be encrypted so would not be usable. Is there a way to send the email before the record is created and the password is encrypted?

Thank you in advance,

Robert

 
smokinpuppy     Založený: 26.03.2012   Príspevky: 14  
Príspevok Zaslal: 2012-06-17 11:13
Návrat hore  Odpovedať s citátom     

I figured it out, I modified the code in this thread:
http://opensource.platon.sk/forum/projects/viewtopic.php?t=1113&highlight=notify+email

Thank you zucarino :).

1) Create the Mail Notify file email_notify_RYH.php , something like this:
Kód:
<?php
// Show message:
echo "<span style='background-color: #FEFFE6'>Record $this->rec updated!</span>";

//----- Send Notification Email to New or Updated Control Panel User ----->
$name = "Some_Name";
$from = "from_email@yourweb.com";
$to = $newvals['email'];
$subject = "New/Updated User Information";
$message = "<html>
   <head></head>
      <body> 
         <table border='0' cellpadding='0' cellspacing='0' align='center' width='550'>
            <tr><td><img src='images/emailheader.jpg' alt='alttxt'><br><br></td></tr>
            <tr><td>Dear ".$newvals['fname'].",<br><br>Here is your User Information:<br>";
                foreach($newvals as $key => $val){
                     $message .= "<b>" . $key . " : </b>" . $val . "<br />";
                }
            $message .= "<br>Best regards,<br>Some Signature<br><br>";
            $message .= "<tr><td><img src='images/emailfooter.jpg' alt='alttxt'><br><br></td></tr>
              </table>
             </body>
   </html>";
      
// Setup Headers
"--{$mime_boundary}--\n";
$headers = "From: $name<$from>" . "\n";
$headers .= "Reply-To: $from"."\n";
$headers .= "Return-Path: $from" . "\n";
$headers .= "Date: ".date("r")."\n";
$headers .= "MIME-Version: 1.0\n" .
"Content-type: text/html; charset=iso-8859-1 \n";
      
// Send it
if (mail($to, $subject, $message, $headers)) {
   echo(" Mail sent!");
} else {
   echo(" Mail delivery failed");
}

?>


2) Add these lines on your PME file to use the trigger (before the line who calls the PME Class):

Code:
Kód:
$opts['triggers']['insert']['before']  = 'include/email_notify_RYH.php';
$opts['triggers']['update']['before']  = 'include/email_notify_RYH.php';


3) Test...

Best regards!

 
Odoslať novú tému   Odpovedať na tému    

Copyright © 2002-2006 Platon Group
Stránka používa redakčný systém Metafox
Na začiatok · Odkazový formulár · Prihláška
Upozorniť na chybu na PLATON.SK webstránke · Podmienky použitia · Ochrana osobných údajov