diff --git a/application/controllers/welcome.php b/application/controllers/welcome.php
index d9fa1fe..c986c1c 100644
--- a/application/controllers/welcome.php
+++ b/application/controllers/welcome.php
@@ -196,6 +196,40 @@ class Welcome extends CI_Controller
$this->ecard->insert($entry);
+ if (($apikey = $this->config->item('mandrill_apikey'))) {
+
+ define('MAILCHIMP_API_KEY', $apikey);
+
+ $this->load->library('Maildeliverysystem');
+
+ $email_receivers = array(
+ array(
+ 'name' => $entry['receiver_name'],
+ 'email' => $entry['receiver_email']
+ )
+ );
+
+ $email_sender_name = $entry['uploader_name'];
+ $email_sender_email = $entry['uploader_email'];
+
+ $entry['websiteurl'] = site_url('ecards/' . $entry['hash']);
+ $entry['imageurl'] = site_url('assets/cards/' . $entry['hash'] . '.png');
+
+ $email_content = $this->load->view('email_template', $entry, true);
+
+ // Send order confirmation
+ $this->maildeliverysystem->sendmail(
+ $email_receivers,
+ $email_content,
+ "Ystäväkylän sähköpostikortti",
+ $email_sender_name,
+ $email_sender_email,
+ array(
+ 'reply-to' => $email_sender_email
+ )
+ );
+ }
+
redirect(site_url('ecards/' . $entry['hash']));
}
}
diff --git a/application/libraries/Maildeliverysystem.php b/application/libraries/Maildeliverysystem.php
index 8cbcf83..116c659 100644
--- a/application/libraries/Maildeliverysystem.php
+++ b/application/libraries/Maildeliverysystem.php
@@ -200,7 +200,7 @@ class MailDeliverySystem
*/
public function buildMessage()
{
- $tracking_domain = getEmailDomain($this->sender_email);
+ $tracking_domain = "ystavakyla.fi";
$message = array(
'html' => $this->content, // ci view
diff --git a/application/views/email_template.php b/application/views/email_template.php
new file mode 100644
index 0000000..ad85857
--- /dev/null
+++ b/application/views/email_template.php
@@ -0,0 +1,837 @@
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+ Hei !
+
+ lähetti sinulle
+ Ystäväkylän sähköpostikorttipalvelun kautta tämän viestin:
+
+
+ 
+
+
+ |
+ |
+
+
+
+ |
+
+
+
+
+
+
+
+ |
+
+
+
+
+
+
+
+ |
+
+
+
+
\ No newline at end of file