To receive notifications about scheduled maintenance, please subscribe to the mailing-list You can subscribe to the mailing-list at

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:// 613144d5-4475-0410-9df3-888732ad2c88
parent 40178e8d
#!/usr/bin/env python
__author__ = "Reto Da Forno <>"
__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__)
msg =
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.stdout.write("sending mail with subject '" + s + "' to " + str(len(r)) + " recipient(s) in ")
for x in range(5, 0, -1):
sys.stdout.write('\b' + str(x))
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:\r\nReply-To:");
We have activated your FlockLab account and you should now be able to login at
We strongly recommend you to walk through the tutorials that explain
how FlockLab can be used:
If you have questions, please use the according Google Group:!forum/flocklab-users
Please do not forget to cite our papers when writing publications with
the help of FlockLab:
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