diff --git a/ces_message/ces_message.install b/ces_message/ces_message.install
index ed2a12d..da7fcbf 100755
--- a/ces_message/ces_message.install
+++ b/ces_message/ces_message.install
@@ -215,6 +215,11 @@ function ces_message_install() {
   ces_message_install_action('account_debit_pending', 'Account debit pending');
   ces_message_install_action('account_debit_rejected', 'Account debit rejected');
   ces_message_install_action('account_credit_rejected', 'Account credit rejected');
+  ces_message_install_action('alert_offerwant_expired', 'Offer/want expired');
+  ces_message_install_action('alert_offerwant_newoffer', 'New offering in the exchange');
+  ces_message_install_action('alert_offerwant_newwant', 'New want in the exchange');
+  ces_message_install_action('alert_offerwant_offersperiodical', 'Periodical list of offerings');
+  ces_message_install_action('alert_offerwant_wantsperiodical', 'Periodical list of wants');
 
   ces_message_install_default_templates();
 }
@@ -240,12 +245,24 @@ function ces_message_update_7102() {
   ces_message_install_default_templates();
 }
 /**
- * Quirt update 10/7/2014.
+ * Fourth update 10/7/2014.
  */
 function ces_message_update_7103() {
   ces_message_install_default_templates();
 }
 /**
+ * Fiveth update 10/12/2015.
+ */
+function ces_message_update_7110() {
+  ces_message_install_action('alert_offerwant_expired', 'Offer/want expired');
+  ces_message_install_action('alert_offerwant_newoffer', 'New offering in the exchange');
+  ces_message_install_action('alert_offerwant_newwant', 'New want in the exchange');
+  ces_message_install_action('alert_offerwant_offersperiodical', 'Periodical list of offerings');
+  ces_message_install_action('alert_offerwant_wantsperiodical', 'Periodical list of wants');
+
+  ces_message_install_default_templates();
+}
+/**
  * Implements hook_uninstall().
  *
  * At uninstall time we'll notify field.module that the entity was deleted
diff --git a/ces_message/ces_message.module b/ces_message/ces_message.module
index 62a1af5..010aa1c 100755
--- a/ces_message/ces_message.module
+++ b/ces_message/ces_message.module
@@ -398,7 +398,6 @@ function ces_message_send_notify($action, $params, $recipient = array(), $sender
 
   }
 }
-
 /**
  * Implements hook_mail().
  */
@@ -430,6 +429,36 @@ function ces_message_mail($key, &$message, $params) {
 
 }
 /**
+ * Send email for alerts.
+ *
+ * @param string $action
+ *   Ces action.
+ * @param array $params
+ *   Array with the objects needed to process the template.
+ * @param array $exchange
+ *   Exchange ID to send the email.
+ */
+function ces_message_send_alert_email($action, $params, $recipient = array(), $attachment = NULL) {
+  if (!empty($params['exchange']) && !empty($recipient)) {
+    foreach ($recipient as $user_recipient_id) {
+      $user_recipient = user_load($user_recipient_id);
+      $language_recipient = user_preferred_language($user_recipient);
+      $language = $language_recipient->language;
+
+      $template = ces_message_get_template($action, $language, $params['exchange']['id']);
+
+      if (!$template) {
+        drupal_set_message(t('No template from action'), 'error');
+        return FALSE;
+      }
+      $from_admin = user_load($params['exchange']['admin']);
+      $subject  = token_replace($template->subject, $params);
+      $body     = token_replace($template->body, $params);
+      drupal_mail('ces_offerswants', $action, $user_recipient->mail, $language, $params, $from_admin->mail, TRUE);
+    }
+  }
+}
+/**
  * Provides a test.
  */
 function ces_message_template_test($action = 'account_activated', $recipient = 1) {
diff --git a/ces_message/includes/actions/ca/alert_offerwant_expired.inc b/ces_message/includes/actions/ca/alert_offerwant_expired.inc
new file mode 100644
index 0000000..845c3b4
--- /dev/null
+++ b/ces_message/includes/actions/ca/alert_offerwant_expired.inc
@@ -0,0 +1,26 @@
+<?php
+
+/**
+ * @file
+ * Catalan alert offerwant expired template.
+ *
+ * @ingroup ces_message_template
+ */
+
+$subject = '[[exchange:shortname]] La teva oferta/demanda ha caducat: [offer:title]';
+
+$body = 'Benvolgut/da [account:user:fullname],
+
+La teva oferta/demanda ha caducat:
+[offer:title]
+
+Per a actualitzar-la, pots visitar:
+[site:url]/ces/bank/account/my[offer:type]s/[offer:id]/edit
+
+Bons intercanvis!
+
+[exchange:shortname] administrador:
+[exchange:admin:fullname]
+[exchange:admin:mail]
+[exchange:admin:mainphone]
+';
diff --git a/ces_message/includes/actions/ca/alert_offerwant_newoffer.inc b/ces_message/includes/actions/ca/alert_offerwant_newoffer.inc
new file mode 100644
index 0000000..62ab374
--- /dev/null
+++ b/ces_message/includes/actions/ca/alert_offerwant_newoffer.inc
@@ -0,0 +1,22 @@
+<?php
+
+/**
+ * @file
+ * Catalan alert new offer template.
+ *
+ * @ingroup ces_message_template
+ */
+
+$subject = '[[exchange:shortname]] Nova oferta a la teva xarxa';
+
+$body = 'Benvolgut/da [account:user:fullname],
+
+Una nova oferta s\'ha creat a la teva xarxa.
+
+Bons intercanvis!
+
+[exchange:shortname] administrador:
+[exchange:admin:fullname]
+[exchange:admin:mail]
+[exchange:admin:mainphone]
+';
diff --git a/ces_message/includes/actions/ca/alert_offerwant_newwant.inc b/ces_message/includes/actions/ca/alert_offerwant_newwant.inc
new file mode 100644
index 0000000..d3a49ec
--- /dev/null
+++ b/ces_message/includes/actions/ca/alert_offerwant_newwant.inc
@@ -0,0 +1,22 @@
+<?php
+
+/**
+ * @file
+ * Catalan alert new want template.
+ *
+ * @ingroup ces_message_template
+ */
+
+$subject = '[[exchange:shortname]] Nova demanda a la teva xarxa';
+
+$body = 'Benvolgut/da [account:user:fullname],
+
+Una nova demanda s\'ha creat a la teva xarxa.
+
+Bons intercanvis!
+
+[exchange:shortname] administrador:
+[exchange:admin:fullname]
+[exchange:admin:mail]
+[exchange:admin:mainphone]
+';
diff --git a/ces_message/includes/actions/ca/alert_offerwant_offersperiodical.inc b/ces_message/includes/actions/ca/alert_offerwant_offersperiodical.inc
new file mode 100644
index 0000000..8e31b22
--- /dev/null
+++ b/ces_message/includes/actions/ca/alert_offerwant_offersperiodical.inc
@@ -0,0 +1,22 @@
+<?php
+
+/**
+ * @file
+ * Catalan alert periodical offers template.
+ *
+ * @ingroup ces_message_template
+ */
+
+$subject = '[[exchange:shortname]] Llistat de les darreres ofertes';
+
+$body = 'Benvolgut/da [account:user:fullname],
+
+Aquesta és una llista de les darreres actualitzacions d\'ofertes a la teva xarxa.
+
+Bons intercanvis!
+
+[exchange:shortname] administrador:
+[exchange:admin:fullname]
+[exchange:admin:mail]
+[exchange:admin:mainphone]
+';
diff --git a/ces_message/includes/actions/ca/alert_offerwant_wantsperiodical.inc b/ces_message/includes/actions/ca/alert_offerwant_wantsperiodical.inc
new file mode 100644
index 0000000..008a313
--- /dev/null
+++ b/ces_message/includes/actions/ca/alert_offerwant_wantsperiodical.inc
@@ -0,0 +1,22 @@
+<?php
+
+/**
+ * @file
+ * Catalan alert periodical wants template.
+ *
+ * @ingroup ces_message_template
+ */
+
+$subject = '[[exchange:shortname]] Llistat de les darreres demandes';
+
+$body = 'Benvolgut/da [account:user:fullname],
+
+Aquesta és una llista de les darreres actualitzacions de demandes a la teva xarxa.
+
+Bons intercanvis!
+
+[exchange:shortname] administrador:
+[exchange:admin:fullname]
+[exchange:admin:mail]
+[exchange:admin:mainphone]
+';
diff --git a/ces_message/includes/actions/en/alert_offerwant_expired.inc b/ces_message/includes/actions/en/alert_offerwant_expired.inc
new file mode 100644
index 0000000..3b3cceb
--- /dev/null
+++ b/ces_message/includes/actions/en/alert_offerwant_expired.inc
@@ -0,0 +1,26 @@
+<?php
+
+/**
+ * @file
+ * English alert offerwant expired template.
+ *
+ * @ingroup ces_message_template
+ */
+
+$subject = '[[exchange:shortname]] Your [offer:type] is expired: [offer:title]';
+
+$body = 'Dear [account:user:fullname],
+
+Your [offer:type] is expired:
+[offer:title]
+
+To update your [offer:type], please visit:
+[site:url]/ces/bank/account/my[offer:type]s/[offer:id]/edit
+
+Happy trading!
+
+[exchange:shortname] administrator:
+[exchange:admin:fullname]
+[exchange:admin:mail]
+[exchange:admin:mainphone]
+';
diff --git a/ces_message/includes/actions/en/alert_offerwant_newoffer.inc b/ces_message/includes/actions/en/alert_offerwant_newoffer.inc
new file mode 100644
index 0000000..3a2c761
--- /dev/null
+++ b/ces_message/includes/actions/en/alert_offerwant_newoffer.inc
@@ -0,0 +1,22 @@
+<?php
+
+/**
+ * @file
+ * English alert new offer template.
+ *
+ * @ingroup ces_message_template
+ */
+
+$subject = '[[exchange:shortname]] New offer in your network';
+
+$body = 'Dear [account:user:fullname],
+
+A new offer has been created in your network.
+
+Happy trading!
+
+[exchange:shortname] administrator:
+[exchange:admin:fullname]
+[exchange:admin:mail]
+[exchange:admin:mainphone]
+';
diff --git a/ces_message/includes/actions/en/alert_offerwant_newwant.inc b/ces_message/includes/actions/en/alert_offerwant_newwant.inc
new file mode 100644
index 0000000..998bc96
--- /dev/null
+++ b/ces_message/includes/actions/en/alert_offerwant_newwant.inc
@@ -0,0 +1,22 @@
+<?php
+
+/**
+ * @file
+ * English alert new want template.
+ *
+ * @ingroup ces_message_template
+ */
+
+$subject = '[[exchange:shortname]] New want in your network';
+
+$body = 'Dear [account:user:fullname],
+
+A new want has been created in your network.
+
+Happy trading!
+
+[exchange:shortname] administrator:
+[exchange:admin:fullname]
+[exchange:admin:mail]
+[exchange:admin:mainphone]
+';
diff --git a/ces_message/includes/actions/en/alert_offerwant_offersperiodical.inc b/ces_message/includes/actions/en/alert_offerwant_offersperiodical.inc
new file mode 100644
index 0000000..4b1567b
--- /dev/null
+++ b/ces_message/includes/actions/en/alert_offerwant_offersperiodical.inc
@@ -0,0 +1,22 @@
+<?php
+
+/**
+ * @file
+ * English alert periodical offers template.
+ *
+ * @ingroup ces_message_template
+ */
+
+$subject = '[[exchange:shortname]] Last offerings list';
+
+$body = 'Dear [account:user:fullname],
+
+This is a list of the last updated offerings in your network.
+
+Happy trading!
+
+[exchange:shortname] administrator:
+[exchange:admin:fullname]
+[exchange:admin:mail]
+[exchange:admin:mainphone]
+';
diff --git a/ces_message/includes/actions/en/alert_offerwant_wantsperiodical.inc b/ces_message/includes/actions/en/alert_offerwant_wantsperiodical.inc
new file mode 100644
index 0000000..db1448f
--- /dev/null
+++ b/ces_message/includes/actions/en/alert_offerwant_wantsperiodical.inc
@@ -0,0 +1,22 @@
+<?php
+
+/**
+ * @file
+ * English alert periodical wants template.
+ *
+ * @ingroup ces_message_template
+ */
+
+$subject = '[[exchange:shortname]] Last wants list';
+
+$body = 'Dear [account:user:fullname],
+
+This is a list of the last updated wants in your network.
+
+Happy trading!
+
+[exchange:shortname] administrator:
+[exchange:admin:fullname]
+[exchange:admin:mail]
+[exchange:admin:mainphone]
+';
diff --git a/ces_message/includes/actions/es/alert_offerwant_expired.inc b/ces_message/includes/actions/es/alert_offerwant_expired.inc
new file mode 100644
index 0000000..d62c63f
--- /dev/null
+++ b/ces_message/includes/actions/es/alert_offerwant_expired.inc
@@ -0,0 +1,26 @@
+<?php
+
+/**
+ * @file
+ * Spanish alert offerwant expired template.
+ *
+ * @ingroup ces_message_template
+ */
+
+$subject = '[[exchange:shortname]] Tu oferta/demanda ha caducado: [offer:title]';
+
+$body = 'Estimado/a [account:user:fullname],
+
+Tu oferta/demanda ha caducado:
+[offer:title]
+
+Para actualizarla, puedes visitar:
+[site:url]/ces/bank/account/my[offer:type]s/[offer:id]/edit
+
+Feliz intercambio!
+
+[exchange:shortname] administrador:
+[exchange:admin:fullname]
+[exchange:admin:mail]
+[exchange:admin:mainphone]
+';
diff --git a/ces_message/includes/actions/es/alert_offerwant_newoffer.inc b/ces_message/includes/actions/es/alert_offerwant_newoffer.inc
new file mode 100644
index 0000000..20b0bd9
--- /dev/null
+++ b/ces_message/includes/actions/es/alert_offerwant_newoffer.inc
@@ -0,0 +1,22 @@
+<?php
+
+/**
+ * @file
+ * Spanish alert new offer template.
+ *
+ * @ingroup ces_message_template
+ */
+
+$subject = '[[exchange:shortname]] Nueva oferta en tu red';
+
+$body = 'Estimado/a [account:user:fullname],
+
+Una nueva oferta se ha creado en tu red.
+
+Feliz intercambio!
+
+[exchange:shortname] administrador:
+[exchange:admin:fullname]
+[exchange:admin:mail]
+[exchange:admin:mainphone]
+';
diff --git a/ces_message/includes/actions/es/alert_offerwant_newwant.inc b/ces_message/includes/actions/es/alert_offerwant_newwant.inc
new file mode 100644
index 0000000..f58e7a0
--- /dev/null
+++ b/ces_message/includes/actions/es/alert_offerwant_newwant.inc
@@ -0,0 +1,22 @@
+<?php
+
+/**
+ * @file
+ * Spanish alert new want template.
+ *
+ * @ingroup ces_message_template
+ */
+
+$subject = '[[exchange:shortname]] Nueva demanda en tu red';
+
+$body = 'Estimado/a [account:user:fullname],
+
+Una nueva demanda ha sido creada en tu red.
+
+Feliz intercambio!
+
+[exchange:shortname] administrador:
+[exchange:admin:fullname]
+[exchange:admin:mail]
+[exchange:admin:mainphone]
+';
diff --git a/ces_message/includes/actions/es/alert_offerwant_offersperiodical.inc b/ces_message/includes/actions/es/alert_offerwant_offersperiodical.inc
new file mode 100644
index 0000000..f2234b7
--- /dev/null
+++ b/ces_message/includes/actions/es/alert_offerwant_offersperiodical.inc
@@ -0,0 +1,22 @@
+<?php
+
+/**
+ * @file
+ * Spanish alert periodical offers template.
+ *
+ * @ingroup ces_message_template
+ */
+
+$subject = '[[exchange:shortname]] Listado de últimas ofertas';
+
+$body = 'Estimado/a [account:user:fullname],
+
+Este es un listado de las últimas actualizaciones de ofertas en tu red.
+
+Feliz intercambio!
+
+[exchange:shortname] administrador:
+[exchange:admin:fullname]
+[exchange:admin:mail]
+[exchange:admin:mainphone]
+';
diff --git a/ces_message/includes/actions/es/alert_offerwant_wantsperiodical.inc b/ces_message/includes/actions/es/alert_offerwant_wantsperiodical.inc
new file mode 100644
index 0000000..c42b1fc
--- /dev/null
+++ b/ces_message/includes/actions/es/alert_offerwant_wantsperiodical.inc
@@ -0,0 +1,22 @@
+<?php
+
+/**
+ * @file
+ * Spanish alert periodical wants template.
+ *
+ * @ingroup ces_message_template
+ */
+
+$subject = '[[exchange:shortname]] Listado de últimas demandas';
+
+$body = 'Dear [account:user:fullname],
+
+Este es un listado de las últimas actualizaciones de demandas en tu red.
+
+Feliz intercambio!
+
+[exchange:shortname] administrador:
+[exchange:admin:fullname]
+[exchange:admin:mail]
+[exchange:admin:mainphone]
+';
diff --git a/ces_offerswants/ces_offerswants.info b/ces_offerswants/ces_offerswants.info
index f5679f6..f2636e9 100644
--- a/ces_offerswants/ces_offerswants.info
+++ b/ces_offerswants/ces_offerswants.info
@@ -3,5 +3,7 @@ description = Simple offers and wants module.
 core = 7.x
 package = ices
 dependencies[] = ices
+dependencies[] = ces_bank
+dependencies[] = ces_message
 dependencies[] = image
 files[] = ces_offerswants.test
diff --git a/ces_offerswants/ces_offerswants.install b/ces_offerswants/ces_offerswants.install
index d927385..58b6736 100644
--- a/ces_offerswants/ces_offerswants.install
+++ b/ces_offerswants/ces_offerswants.install
@@ -187,6 +187,131 @@ function ces_offerswants_schema() {
     ),
     'primary key' => array('cid'),
   );
+  $schema['ces_alerts'] = array(
+    'description' => 'Table for offers&wants alerts of each exchange.',
+    'fields' => array(
+      'id' => array(
+        'description' => 'Primary Key: Unique alert ID.',
+        'type' => 'serial',
+        'unsigned' => TRUE,
+        'not null' => TRUE,
+      ),
+      'exchange' => array(
+        'description' => 'The {ces_exchange}.id of the alerts.',
+        'type' => 'int',
+        'unsigned' => TRUE,
+        'default' => 0,
+      ),
+      'expired_status' => array(
+        'description' => 'Enabled/disabled alert offerwant expired.',
+        'type' => 'int',
+        'unsigned' => TRUE,
+        'not null' => TRUE,
+        'default' => 1,
+      ),
+      'expired_lasttime' => array(
+        'description' => 'Last time cron runs alert offerwant expired, as a Unix timestamp.',
+        'type' => 'int',
+        'unsigned' => TRUE,
+        'not null' => TRUE,
+        'default' => 0,
+      ),
+      'expired_noalertusers' => array(
+        'description' => 'Users not to send alert offerwant expired.',
+        'type' => 'blob',
+        'not null' => TRUE,
+        'serialize' => TRUE,
+      ),
+      'newoffer_status' => array(
+        'description' => 'Enabled/disabled alert newoffer.',
+        'type' => 'int',
+        'unsigned' => TRUE,
+        'not null' => TRUE,
+        'default' => 1,
+      ),
+      'newoffer_lasttime' => array(
+        'description' => 'Last time cron runs alert newoffer, as a Unix timestamp.',
+        'type' => 'int',
+        'unsigned' => TRUE,
+        'not null' => TRUE,
+        'default' => 0,
+      ),
+      'newoffer_noalertusers' => array(
+        'description' => 'Users not to send alert newoffer.',
+        'type' => 'blob',
+        'not null' => TRUE,
+        'serialize' => TRUE,
+      ),
+      'newwant_status' => array(
+        'description' => 'Enabled/disabled alert newwant.',
+        'type' => 'int',
+        'unsigned' => TRUE,
+        'not null' => TRUE,
+        'default' => 1,
+      ),
+      'newwant_lasttime' => array(
+        'description' => 'Last time cron runs alert newwant, as a Unix timestamp.',
+        'type' => 'int',
+        'unsigned' => TRUE,
+        'not null' => TRUE,
+        'default' => 0,
+      ),
+      'newwant_noalertusers' => array(
+        'description' => 'Users not to send alert newwant.',
+        'type' => 'blob',
+        'not null' => TRUE,
+        'serialize' => TRUE,
+      ),
+      'offersperiodical_status' => array(
+        'description' => 'Alert offers periodical: disabled(0), weekly(1), biweekly(2), monthly(3), bimonthly(4).',
+        'type' => 'int',
+        'unsigned' => TRUE,
+        'not null' => TRUE,
+        'default' => 1,
+      ),
+      'offersperiodical_lasttime' => array(
+        'description' => 'Last time cron runs alert offers periodical, as a Unix timestamp.',
+        'type' => 'int',
+        'unsigned' => TRUE,
+        'not null' => TRUE,
+        'default' => 0,
+      ),
+      'offersperiodical_noalertusers' => array(
+        'description' => 'Users not to send alert offers periodical.',
+        'type' => 'blob',
+        'not null' => TRUE,
+        'serialize' => TRUE,
+      ),
+      'wantsperiodical_status' => array(
+        'description' => 'Alert wants periodical: disabled(0), weekly(1), biweekly(2), monthly(3), bimonthly(4).',
+        'type' => 'int',
+        'unsigned' => TRUE,
+        'not null' => TRUE,
+        'default' => 1,
+      ),
+      'wantsperiodical_lasttime' => array(
+        'description' => 'Last time cron runs alert wants periodical, as a Unix timestamp.',
+        'type' => 'int',
+        'unsigned' => TRUE,
+        'not null' => TRUE,
+        'default' => 0,
+      ),
+      'wantsperiodical_noalertusers' => array(
+        'description' => 'Users not to send alert wants periodical.',
+        'type' => 'blob',
+        'not null' => TRUE,
+        'serialize' => TRUE,
+      ),
+      'created' => array(
+        'type' => 'int',
+        'unsigned' => TRUE,
+        'not null' => TRUE,
+        'default' => 0,
+        'description' => 'The time that the alerts for this exchange were created, as a Unix timestamp.',
+      ),
+    ),
+    'primary key' => array('id'),
+  );
   return $schema;
 }
 
@@ -240,6 +365,137 @@ function ces_offerswants_update_7100() {
 }
 
 /**
+ * Implements hook_update_N().
+ */
+function ces_offerswants_update_7101() {
+  $schema['ces_alerts'] = array(
+    'description' => 'Table for offers&wants alerts of each exchange.',
+    'fields' => array(
+      'id' => array(
+        'description' => 'Primary Key: Unique alert ID.',
+        'type' => 'serial',
+        'unsigned' => TRUE,
+        'not null' => TRUE,
+      ),
+      'exchange' => array(
+        'description' => 'The {ces_exchange}.id of the alerts.',
+        'type' => 'int',
+        'unsigned' => TRUE,
+        'default' => 0,
+      ),
+      'expired_status' => array(
+        'description' => 'Enabled/disabled alert offerwant expired.',
+        'type' => 'int',
+        'unsigned' => TRUE,
+        'not null' => TRUE,
+        'default' => 1,
+      ),
+      'expired_lasttime' => array(
+        'description' => 'Last time cron runs alert offerwant expired, as a Unix timestamp.',
+        'type' => 'int',
+        'unsigned' => TRUE,
+        'not null' => TRUE,
+        'default' => 0,
+      ),
+      'expired_noalertusers' => array(
+        'description' => 'Users not to send alert offerwant expired.',
+        'type' => 'blob',
+        'not null' => TRUE,
+        'serialize' => TRUE,
+      ),
+      'newoffer_status' => array(
+        'description' => 'Enabled/disabled alert newoffer.',
+        'type' => 'int',
+        'unsigned' => TRUE,
+        'not null' => TRUE,
+        'default' => 1,
+      ),
+      'newoffer_lasttime' => array(
+        'description' => 'Last time cron runs alert newoffer, as a Unix timestamp.',
+        'type' => 'int',
+        'unsigned' => TRUE,
+        'not null' => TRUE,
+        'default' => 0,
+      ),
+      'newoffer_noalertusers' => array(
+        'description' => 'Users not to send alert newoffer.',
+        'type' => 'blob',
+        'not null' => TRUE,
+        'serialize' => TRUE,
+      ),
+      'newwant_status' => array(
+        'description' => 'Enabled/disabled alert newwant.',
+        'type' => 'int',
+        'unsigned' => TRUE,
+        'not null' => TRUE,
+        'default' => 1,
+      ),
+      'newwant_lasttime' => array(
+        'description' => 'Last time cron runs alert newwant, as a Unix timestamp.',
+        'type' => 'int',
+        'unsigned' => TRUE,
+        'not null' => TRUE,
+        'default' => 0,
+      ),
+      'newwant_noalertusers' => array(
+        'description' => 'Users not to send alert newwant.',
+        'type' => 'blob',
+        'not null' => TRUE,
+        'serialize' => TRUE,
+      ),
+      'offersperiodical_status' => array(
+        'description' => 'Alert offers periodical: disabled(0), weekly(1), biweekly(2), monthly(3), bimonthly(4).',
+        'type' => 'int',
+        'unsigned' => TRUE,
+        'not null' => TRUE,
+        'default' => 1,
+      ),
+      'offersperiodical_lasttime' => array(
+        'description' => 'Last time cron runs alert offers periodical, as a Unix timestamp.',
+        'type' => 'int',
+        'unsigned' => TRUE,
+        'not null' => TRUE,
+        'default' => 0,
+      ),
+      'offersperiodical_noalertusers' => array(
+        'description' => 'Users not to send alert offers periodical.',
+        'type' => 'blob',
+        'not null' => TRUE,
+        'serialize' => TRUE,
+      ),
+      'wantsperiodical_status' => array(
+        'description' => 'Alert wants periodical: disabled(0), weekly(1), biweekly(2), monthly(3), bimonthly(4).',
+        'type' => 'int',
+        'unsigned' => TRUE,
+        'not null' => TRUE,
+        'default' => 1,
+      ),
+      'wantsperiodical_lasttime' => array(
+        'description' => 'Last time cron runs alert wants periodical, as a Unix timestamp.',
+        'type' => 'int',
+        'unsigned' => TRUE,
+        'not null' => TRUE,
+        'default' => 0,
+      ),
+      'wantsperiodical_noalertusers' => array(
+        'description' => 'Users not to send alert wants periodical.',
+        'type' => 'blob',
+        'not null' => TRUE,
+        'serialize' => TRUE,
+      ),
+      'created' => array(
+        'type' => 'int',
+        'unsigned' => TRUE,
+        'not null' => TRUE,
+        'default' => 0,
+        'description' => 'The time that the alerts for this exchange were created, as a Unix timestamp.',
+      ),
+    ),
+    'primary key' => array('id'),
+  );
+  db_create_table('ces_alerts', $schema['ces_alerts']);
+}
+/**
  * Implements hook_install().
  */
 function ces_offerswants_install() {
diff --git a/ces_offerswants/ces_offerswants.module b/ces_offerswants/ces_offerswants.module
index 5852373..1b3b535 100644
--- a/ces_offerswants/ces_offerswants.module
+++ b/ces_offerswants/ces_offerswants.module
@@ -402,6 +402,15 @@ function ces_offerswants_menu() {
     'page arguments' => array(4),
     'access callback' => TRUE,
   );
+    $menu['ces/admin/alerts'] = array(
+    'title' => 'Email alerts',
+    'description' => 'Preferences about offers and wants email alerts',
+    'page callback' => 'drupal_get_form',
+    'page arguments' => array('ces_alerts_form'),
+    'access callback' => 'ces_bank_access',
+    'access arguments' => array('edit', 'exchange', CES_BANK_CURRENT_EXCHANGE),
+    'type' => MENU_NORMAL_ITEM,
+  );
   return $menu;
 }
 /**
@@ -1121,6 +1130,332 @@ function ces_category_access($permission, $category) {
   return ces_bank_access($permission, 'exchange', $category->exchange);
 }
 /**
+ * Edit alerts form.
+ */
+function ces_alerts_form($form, &$form_state) {
+  $form = array();
+  $exchange = ces_bank_get_current_exchange();
+  $alerts = db_query("SELECT * FROM {ces_alerts} WHERE exchange = :exchange",
+    array(':exchange' => $exchange['id']));
+  if ($alerts->rowCount() > 0) {
+    foreach ($alerts as $row) {
+      $alert = $row;
+    }
+  }
+  $form['templates'] = array(
+    '#type' => 'item',
+    '#description' => t('Note: If enabled, the system checks these email alerts every time cron is run, usually once every 24h (ask for exact frequency to your site admin). All users can disable these alerts in their profiles. Email templates can be personalized in Administration > Templates.'),
+  );
+  $form['expired'] = array(
+    '#type' => 'fieldset',
+    '#title' => t('Expired offer or want alert.'),
+    '#collapsible' => FALSE,
+  );
+  $form['expired']['expired_status'] = array(
+    '#type' => 'checkbox',
+    '#title' => t('Enable expired alert.'),
+    '#default_value' => isset($alert->expired_status) ? $alert->expired_status : 0,
+    '#description' => t('The system will check for last expired offers and wants, and will send an email to the user owner.  If no offer or want is expired since last time cron run, no email is sent.'),
+  );
+  $form['newoffer'] = array(
+    '#type' => 'fieldset',
+    '#title' => t('New offer alert.'),
+    '#collapsible' => FALSE,
+  );
+  $form['newoffer']['newoffer_status'] = array(
+    '#type' => 'checkbox',
+    '#title' => t('Enable new offer alert.'),
+    '#default_value' => isset($alert->newoffer_status) ? $alert->newoffer_status : 0,
+    '#description' => t('The system will check for last created offers, and will send an email to all users of the exchange with these offers. If no offer is created since last time cron run, no email is sent.'),
+  );
+  $form['newwant'] = array(
+    '#type' => 'fieldset',
+    '#title' => t('New want alert.'),
+    '#collapsible' => FALSE,
+  );
+  $form['newwant']['newwant_status'] = array(
+    '#type' => 'checkbox',
+    '#title' => t('Enable new want alert.'),
+    '#default_value' => isset($alert->newwant_status) ? $alert->newwant_status : 0,
+    '#description' => t('The system will check for last created wantings, and will send an email to all users of the exchange with these wants. If no want is created since last time cron run, no email is sent.'),
+  );
+  $form['offersperiodical'] = array(
+    '#type' => 'fieldset',
+    '#title' => t('Offers periodical alert.'),
+    '#collapsible' => FALSE,
+  );
+  $form['offersperiodical']['offersperiodical_status'] = array(
+    '#type' => 'select',
+    '#title' => t('Frequency of offers periodical alert.'),
+    '#options' => array(
+      0 => t('Disabled'),
+      1 => t('Once a week'),
+      2 => t('Once every two weeks'),
+      3 => t('Once a month'),
+      4 => t('Once every two months'),
+    ),
+    '#default_value' => isset($alert->offersperiodical_status) ? $alert->offersperiodical_status : 0,
+    '#description' => t('With the frequency you select, the system will send an email to all users of the exchange with a list of last updated offers. When you enable this email alert, the first mailing will be done today (next time cron runs), the second will be in the period of time you selected, etc...)'),
+  );
+  $form['wantsperiodical'] = array(
+    '#type' => 'fieldset',
+    '#title' => t('Wants periodical alert.'),
+    '#collapsible' => FALSE,
+  );
+  $form['wantsperiodical']['wantsperiodical_status'] = array(
+    '#type' => 'select',
+    '#title' => t('Frequency of wants periodical alert.'),
+    '#options' => array(
+      0 => t('Disabled'),
+      1 => t('Once a week'),
+      2 => t('Once every two weeks'),
+      3 => t('Once a month'),
+      4 => t('Once every two months'),
+    ),
+    '#default_value' => isset($alert->wantsperiodical_status) ? $alert->wantsperiodical_status : 0,
+    '#description' => t('With the frequency you select, the system will send an email to all users of the exchange with a list of last updated wants. When you enable this email alert, the first mailing will be done today (next time cron runs), the second will be in the period of time you selected, etc...'),
+  );
+  $form['submit'] = array(
+    '#type' => 'submit',
+    '#value' => t('Save'),
+  );
+  return $form;
+}
+/**
+ * Alerts form submit.
+ */
+function ces_alerts_form_submit($form, &$form_state) {
+  $exchange = ces_bank_get_current_exchange();
+  $alerts = db_query("SELECT * FROM {ces_alerts} WHERE exchange = :exchange",
+    array(':exchange' => $exchange['id']));
+  $new_alerts = FALSE;
+  if ($alerts->rowCount() == 0) { // A new row for this exchange needs to be created in db.
+    $new_alerts = TRUE;
+  }
+  else { // The row for this exchange needs to be updated.
+    foreach ($alerts as $row) {
+      $alert = $row;
+    }
+  }
+  $fields = array(
+    'expired_status' => $form_state['values']['expired_status'],
+    'newoffer_status' => $form_state['values']['newoffer_status'],
+    'newwant_status' => $form_state['values']['newwant_status'],
+    'offersperiodical_status' => $form_state['values']['offersperiodical_status'],
+    'wantsperiodical_status' => $form_state['values']['wantsperiodical_status'],
+  );
+  if ($new_alerts) {
+    $fields['exchange'] = $exchange['id'];
+    $anonymous_and_admin = serialize('0,1'); // Init no sending users list with anonymous(0) and admin(1).
+    $fields['expired_noalertusers'] = $anonymous_and_admin;
+    $fields['newoffer_noalertusers'] = $anonymous_and_admin;
+    $fields['newwant_noalertusers'] = $anonymous_and_admin;
+    $fields['offersperiodical_noalertusers'] = $anonymous_and_admin;
+    $fields['wantsperiodical_noalertusers'] = $anonymous_and_admin;
+    $fields['created'] = REQUEST_TIME;
+  }
+  if ($new_alerts || ($alert->expired_status == 0 && $fields['expired_status'] == 1)) {
+    $fields['expired_lasttime'] = REQUEST_TIME;
+  }
+  if ($new_alerts || ($alert->newoffer_status == 0 && $fields['newoffer_status'] == 1)) {
+    $fields['newoffer_lasttime'] = REQUEST_TIME;
+  }
+  if ($new_alerts || ($alert->newwant_status == 0 && $fields['newwant_status'] == 1)) {
+    $fields['newwant_lasttime'] = REQUEST_TIME;
+  }
+  if ($new_alerts || ($alert->offersperiodical_status == 0 && $fields['offersperiodical_status'] > 0)) {
+    switch ($fields['offersperiodical_status']) { // Prepare first mailing for today.
+      case '0':
+        $fields['offersperiodical_lasttime'] = REQUEST_TIME; // New alert but disabled.
+        break;
+      case '1':
+        $fields['offersperiodical_lasttime'] = REQUEST_TIME - 3600*24*7; // One week ago.
+        break;
+      case '2':
+        $fields['offersperiodical_lasttime'] = REQUEST_TIME - 3600*24*14; // Two weeks ago.
+        break;
+      case '3':
+        $fields['offersperiodical_lasttime'] = REQUEST_TIME - 3600*24*31; // One month ago.
+        break;
+      case '4':
+        $fields['offersperiodical_lasttime'] = REQUEST_TIME - 3600*24*62; // Two months ago.
+        break;
+    }
+  }
+  if ($new_alerts || ($alert->wantsperiodical_status == 0 && $fields['wantsperiodical_status'] > 0)) {
+    switch ($fields['wantsperiodical_status']) { // Prepare first mailing for today.
+      case '0':
+        $fields['wantsperiodical_lasttime'] = REQUEST_TIME; // New alert but disabled.
+        break;
+      case '1':
+        $fields['wantsperiodical_lasttime'] = REQUEST_TIME - 3600*24*7; // One week ago.
+        break;
+      case '2':
+        $fields['wantsperiodical_lasttime'] = REQUEST_TIME - 3600*24*14; // Two weeks ago.
+        break;
+      case '3':
+        $fields['wantsperiodical_lasttime'] = REQUEST_TIME - 3600*24*31; // One month ago.
+        break;
+      case '4':
+        $fields['wantsperiodical_lasttime'] = REQUEST_TIME - 3600*24*62; // Two months ago.
+        break;
+    }
+  }
+  if ($new_alerts) {
+    $id = db_insert('ces_alerts')
+      ->fields($fields)
+      ->execute();
+      drupal_set_message(t('The email alerts for exchange :excode have been created.',
+        array(':excode' => $exchange['code'])));
+  }
+  else {
+    $updated = db_update('ces_alerts')
+      ->fields($fields)
+      ->condition('exchange', $exchange['id'])
+      ->execute();
+    drupal_set_message(t('The email alerts for exchange :excode have been updated.',
+      array(':excode' => $exchange['code'])));
+  }
+}
+/*
+ * Implements hook_cron().
+ */
+function ces_offerswants_cron() {
+  $all_exchanges_alerts = db_query('SELECT * FROM {ces_alerts}');
+  $queue = DrupalQueue::get('ces_offerswants_send_emails');
+  $nowtime = time();
+  global $base_url;
+  foreach ($all_exchanges_alerts as $alerts) {
+    $exchange = ces_bank_get_exchange($alerts->exchange);
+    $alerts_done = array();
+    $exchange_users = array();
+    $users = db_query("
+      SELECT au.user FROM {ces_accountuser} au
+      LEFT JOIN {ces_account} a ON au.account = a.id
+      WHERE a.exchange = :exchange",
+      array(
+      ':exchange' => $alerts->exchange,
+      )
+    );
+    foreach ($users as $user) {
+      $exchange_users[] = $user->user;
+    }
+     // Expired alert: sends message and email with ces_message_send_notify.
+    if ($alerts->expired_status == 1) {
+      $expireds = db_query("
+        SELECT ow.id, ow.user
+        FROM {ces_offerwant} ow
+        LEFT JOIN {ces_accountuser} au ON ow.user = au.user
+        LEFT JOIN {ces_account} a ON au.account = a.id
+        WHERE a.exchange = :exchange
+        AND ow.state = 1
+        AND ow.expire > :lasttime
+        AND ow.expire < :nowtime",
+        array(
+          ':exchange' => $alerts->exchange,
+          ':lasttime' => $alerts->expired_lasttime,
+          ':nowtime' => $nowtime,
+        )
+      );
+      foreach ($expireds as $ow) {
+        $data = array(
+          'alert' => 'expired',
+          'params' => array(
+            'exchange' => $exchange,
+            'offer' => ces_offercomment_load($ow->id),
+          ),
+          'recipient' => array($ow->user),
+          'sender_id' => $exchange['admin'],
+        );
+        $queue->createItem($data);
+      }
+      $alerts_done['expired_lasttime'] = $nowtime;
+    }
+
+    // Newoffer alert.
+    if ($alerts->newoffer_status == 1) {
+      $newoffers = db_query("
+        SELECT ow.id, ow.title
+        FROM {ces_offerwant} ow
+        LEFT JOIN {ces_accountuser} au ON ow.user = au.user
+        LEFT JOIN {ces_account} a ON au.account = a.id
+        WHERE a.exchange = :exchange
+        AND ow.state = 1
+        AND ow.type = 'offer'
+        AND ow.created > :lasttime
+        AND ow.created < :nowtime",
+        array(
+          ':exchange' => $alerts->exchange,
+          ':lasttime' => $alerts->newoffer_lasttime,
+          ':nowtime' => $nowtime,
+        )
+      );
+      if ($newoffers->rowCount() > 0) { 
+        $attachment = '<p>' . t('New offer/s:');
+        foreach ($newoffers as $newo) {
+          $attachment .= '<br /><a href="' . $base_url . '/ces/bank/account/myoffers/' . $newo->id . '/view">' .
+            $newo->title . '</a>';
+        }
+        $attachment .= '</p>';
+        $users_nottosend = explode(',', unserialize($alerts->newoffer_noalertusers));
+        foreach ($exchange_users as $user) {
+          if (!in_array($user, $users_nottosend)) {
+            $data = array(
+              'alert' => 'newoffer',
+              'params' => array(
+                'exchange' => $exchange,
+              ),
+              'recipient' => array($user),
+              'attachment' => $attachment,
+            );
+            $queue->createItem($data);
+          }
+        }
+        $alerts_done['newoffer_lasttime'] = $nowtime;
+      }
+    }
+    if ($alerts->newwant_status == 1) {
+//      $queue->createItem($data);
+//      $alerts_done['newwant_lasttime'] = time();
+    }
+    if ($alerts->offersperiodical_status > 0) {
+//      $queue->createItem($data);
+    }
+    if ($alerts->wantsperiodical_status > 0) {
+//      $queue->createItem($data);
+    }
+    if (count($alerts_done) > 0) {
+      $updated = db_update('ces_alerts')
+        ->fields($alerts_done)
+        ->condition('exchange', $exchange['id'])
+        ->execute();
+    }
+  }
+}
+/*
+ * Implements hook_cron_queue_info().
+ */
+function ces_offerswants_cron_queue_info() {
+  $queues['ces_offerswants_send_emails'] = array(
+    'worker callback' => 'ces_offerswants_send_alert_email',
+    'time' => 2,
+  );
+  return $queues;
+}
+/*
+ * Cron queue for mailing.
+ */
+function ces_offerswants_send_alert_email($data) {
+switch ($data['alert']) {
+  case 'expired':
+    ces_message_send_notify('alert_offerwant_expired', $data['params'], $data['recipient'], $data['sender_id'], TRUE);
+    break;
+  case 'newoffer':
+    ces_message_send_alert_email('alert_offerwant_newoffer', $data['params'], $data['recipient'], $data['attachment']);
+    break;
+}
+}
+/**
  * Returns current exchange id.
  *
  * This is a triky function in order to avoid explicit dependence on ces_bank
@@ -2177,6 +2512,10 @@ function ces_offerswants_token_info() {
           'name' => t('Title'),
           'description' => t('Title of offer.'),
         ),
+        'type' => array(
+          'name' => t('Type'),
+          'description' => t('Type of offer: offer or want.'),
+        ),
       ),
       'notify' => array(
         'body' => array(
@@ -2211,6 +2550,9 @@ function ces_offerswants_tokens($type, $tokens, array $data = array(), array $op
         case 'id':
           $replacements[$original] = $sanitize ? check_plain($offer['id']) : $offer['id'];
           break;
+        case 'type':
+          $replacements[$original] = $sanitize ? check_plain($offer->type) : $offer->type;
+          break;
       }
     }
   }
