diff --git a/application/config/application.php b/application/config/application.php
index 99360e8..19795f5 100644
--- a/application/config/application.php
+++ b/application/config/application.php
@@ -28,7 +28,7 @@
$config['archive_path'] = 'static/archives/';
# Where to send system alerts
-$config['system_alert_email'] = 'cron@oconf.org';
+$config['system_alert_email'] = 'ohcrap@getsparks.org';
# The place to email when shit goes wrong
$config['support_email'] = 'ohcrap@getsparks.org';
diff --git a/application/config/config.php b/application/config/config.php
index c9d46e9..63b1991 100644
--- a/application/config/config.php
+++ b/application/config/config.php
@@ -6,6 +6,9 @@
# Use prod settings? (Super-caching, minifying, etc)
$config['is_production'] = FALSE;
+# Environment-specific for SES. Required for mailing.
+$config['ses_secret_key'] = '';
+$config['ses_access_key'] = '';
/*
|--------------------------------------------------------------------------
| Base Site URL
diff --git a/application/helpers/mailer_helper.php b/application/helpers/mailer_helper.php
new file mode 100644
index 0000000..41df068
--- /dev/null
+++ b/application/helpers/mailer_helper.php
@@ -0,0 +1,73 @@
+load->view('email/spark_rejected', array('title' => $subject,
+ 'teaser' => 'Puts up a brick! Your spark submission couldn\'t be verified',
+ 'body' => nl2br($message)),
+ true);
+
+ self::sendEmail($to, $subject, $content, $message, array('cc' => $sys_email));
+ }
+
+ /**
+ * Send a generic email without a fancy footer and header
+ * @param string $to
+ * @param string $subject
+ * @param string $body
+ * @param string $teaser Optional. Appears as a teaser in some email clients
+ */
+ public static function sendEmail($to, $subject, $content, $alt = false, $options = array())
+ {
+ $CI = &get_instance();
+ $CI->load->spark('amazon-ses/0.3.0');
+
+ # Main recipient
+ if(is_array($to))
+ {
+ foreach($to as $addr)
+ $CI->amazon_ses->to($addr);
+ }
+ else
+ {
+ $CI->amazon_ses->to($to);
+ }
+
+ # CCs
+ if(isset($options['cc']))
+ {
+ $cc = $options['cc'];
+ if(is_array($cc))
+ {
+ foreach($cc as $addr)
+ $CI->amazon_ses->cc($addr);
+ }
+ else
+ {
+ $CI->amazon_ses->cc($cc);
+ }
+ }
+
+ $CI->amazon_ses->subject($subject);
+ $CI->amazon_ses->message($content);
+
+ if($alt)
+ $CI->amazon_ses->message_alt($alt);
+
+ $CI->amazon_ses->send();
+ }
+}
diff --git a/application/models/spark.php b/application/models/spark.php
index 324756c..7ad7911 100755
--- a/application/models/spark.php
+++ b/application/models/spark.php
@@ -390,21 +390,23 @@ public function setVersionStatus($version, $deactivated = FALSE)
*/
public function removeTagAndNotify($tag, $errors)
{
- $this->load->helper('email');
+ $this->load->helper('mailer');
$contrib = $this->getContributor();
$sys_email = config_item('system_alert_email');
$message = "Hey there,
+
This is an automated message to tell you that tag '$tag' of
$this->name couldn't be verified ($this->base_location).
We've removed that version from our system at getsparks. Once you get
-things figured out on your end, you can re-add the version :).
+things figured out on your end, you can re-add the version :)
+
Here are some specifics: \n\n";
foreach($errors as $error)
$message .= "$error\n";
- send_email("{$contrib->email},{$sys_email}", "{$this->name} {$tag} Removed.", $message);
+ MailerHelper::sendSparkRejection($contrib->email, "{$this->name} {$tag}", $message);
$this->db->where('spark_id', $this->id);
$this->db->where('tag', $tag);
diff --git a/application/views/email/global/_footer.php b/application/views/email/global/_footer.php
new file mode 100644
index 0000000..5f3cf75
--- /dev/null
+++ b/application/views/email/global/_footer.php
@@ -0,0 +1,26 @@
+
+
+
+
+
+
+
+ |
+
+
+