To receive notifications about scheduled maintenance, please subscribe to the mailing-list gitlab-operations@sympa.ethz.ch. You can subscribe to the mailing-list at https://sympa.ethz.ch

Commit aaee2cfb authored by Reto Da Forno's avatar Reto Da Forno

new script for sending emails added + email for newly registered users is now sent automatically

git-svn-id: svn://svn.ee.ethz.ch/flocklab/trunk/shared@3336 613144d5-4475-0410-9df3-888732ad2c88
parent 40178e8d
#!/usr/bin/env python
__author__ = "Reto Da Forno <reto.daforno@tik.ee.ethz.ch>"
__copyright__ = "Copyright 2018, ETH Zurich, Switzerland"
__license__ = "GPL"
import sys, os, __main__, time, re
scriptpath = '/home/flocklab/flocklab_bin/testmanagementserver'
sys.path.append(scriptpath + '/lib')
import flocklab # local library
if __name__ == "__main__":
if len(sys.argv) != 3:
print "Usage: ./%s [subject] [recipients] < [filename]" % os.path.basename(__main__.__file__)
sys.exit()
msg = sys.stdin.read()
print "mail content:\n" + msg
s = sys.argv[1]
r = re.split('[ ,;]+', sys.argv[2])
if not '@' in r[0]:
print "invalid email address"
sys.exit()
sys.stdout.write("sending mail with subject '" + s + "' to " + str(len(r)) + " recipient(s) in ")
sys.stdout.flush()
try:
for x in range(5, 0, -1):
sys.stdout.write('\b' + str(x))
sys.stdout.flush()
time.sleep(1)
print " "
for usermail in r:
flocklab.send_mail(subject=s, message=msg, recipients=usermail)
print "email sent to " + usermail
except KeyboardInterrupt:
print "\naborted"
......@@ -23,6 +23,17 @@
$db = db_connect();
$sql = "UPDATE tbl_serv_users SET is_active=".mysql_real_escape_string($_POST['is_active'])." WHERE serv_users_key=".mysql_real_escape_string($_POST['user_id']);
$rs = mysql_query($sql) or flocklab_die('Cannot update user propery in database because: ' . mysql_error());
// send email to the user
if ($_POST['is_active']) {
// fetch the user email
$sql = "SELECT email from tbl_serv_users where serv_users_key=".mysql_real_escape_string($_POST['user_id']);
$rs = mysql_query($sql) or flocklab_die('Cannot get user email from database because: ' . mysql_error());
$row = mysql_fetch_array($rs);
if (file_exists("template/newuser_emailtemplate.txt")) {
$msg = file_get_contents("template/newuser_emailtemplate.txt");
mail($row['email'], "Re: Request for FlockLab user account", $msg, "From: flocklab@tik.ee.ethz.ch\r\nReply-To: flocklab-admin@tik.ee.ethz.ch");
}
}
mysql_close($db);
}
?>
......
Hi
We have activated your FlockLab account and you should now be able to login at
https://user.flocklab.ethz.ch
We strongly recommend you to walk through the tutorials that explain
how FlockLab can be used:
http://www.flocklab.ethz.ch/wiki/wiki/Public/Man/GetStarted
If you have questions, please use the according Google Group:
https://groups.google.com/forum/#!forum/flocklab-users
Please do not forget to cite our papers when writing publications with
the help of FlockLab:
https://www.flocklab.ethz.ch/wiki/wiki/Public/Publications
Best regards from the FlockLab team!
Markdown is supported
0% or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment