Permalink
Browse files

added email via smtp server availability

  • Loading branch information...
1 parent 40a6c8e commit fa73305e6e8ff50de3b5d2c04bec1a6987f65eac @mikevalstar committed Jan 18, 2013
Showing with 15 additions and 5 deletions.
  1. +9 −4 class/email.class.php
  2. +5 −0 include/config.inc.example
  3. +1 −1 template/manage/games_item.tpl
View
@@ -3,7 +3,9 @@
class email{
static function send($to, $to_name, $subject, $message, $messageHTML = false){
- $transport = Swift_MailTransport::newInstance();
+ $transport = Swift_SmtpTransport::newInstance(EMAIL_SERVER, 25)
+ ->setUsername(EMAIL_FROM)
+ ->setPassword(EMAIL_PASSWORD);
$mailer = Swift_Mailer::newInstance($transport);
$message = Swift_Message::newInstance()
@@ -12,7 +14,7 @@ static function send($to, $to_name, $subject, $message, $messageHTML = false){
->setSubject($subject)
// Set the From address with an associative array
- ->setFrom(array('no-reply@konradgroup.com' => 'KG Game Knight'))
+ ->setFrom(array(EMAIL_FROM => EMAIL_FROM_NAME))
// Set the To addresses with an associative array
->setTo(array($to => $to_name))
@@ -34,7 +36,10 @@ static function send_all($subject, $message, $messageHTML = false){
foreach($users as $v)
$user_array[$v['email']] = $v['name_first'] . ' ' . $v['name_last'];
- $transport = Swift_MailTransport::newInstance();
+ $transport = Swift_SmtpTransport::newInstance(EMAIL_SERVER, 25)
+ ->setUsername(EMAIL_FROM)
+ ->setPassword(EMAIL_PASSWORD);
+
$mailer = Swift_Mailer::newInstance($transport);
$message = Swift_Message::newInstance()
@@ -43,7 +48,7 @@ static function send_all($subject, $message, $messageHTML = false){
->setSubject($subject)
// Set the From address with an associative array
- ->setFrom(array('no-reply@konradgroup.com' => 'KG Game Knight'))
+ ->setFrom(array(EMAIL_FROM => EMAIL_FROM_NAME))
// Set the To addresses with an associative array
->setTo($user_array)
@@ -7,6 +7,11 @@ define('DB_DB', 'kggamenight');
define('ENV', 'development');
+define('EMAIL_FROM', 'no-reply@example.com');
+define('EMAIL_FROM_NAME', 'KG Game Knight');
+define('EMAIL_SERVER', 'mail.example.com');
+define('EMAIL_PASSWORD', 'password');
+
define('LOGIT_WEB', __DIR__.'/../log/web.log');
define('LOGIT_CRON', __DIR__.'/../log/cron.log');
define('LOGIT_COMMON', __DIR__.'/../log/common.log');
@@ -1,6 +1,6 @@
{extends 'layout.tpl'}
{block "navbar-top"}
- <form class="form-search navbar-form pull-right">
+ <form class="form-search navbar-form pull-right" action="/games">
<div class="input-append">
<input type="text" name="filter" class="input-medium search-query" placeholder="Search Games" />
<button class="btn" type="submit">Search</button>

0 comments on commit fa73305

Please sign in to comment.