-
Notifications
You must be signed in to change notification settings - Fork 0
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
merge master + update contact form email
- Loading branch information
Showing
9 changed files
with
55 additions
and
40 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
|
@@ -312,39 +312,48 @@ function contact() { | |
$email = $this->input->post('email'); | ||
$message = $this->input->post('message'); | ||
|
||
$this->load->library('email'); | ||
|
||
//FIXME: This has to go in a config file. | ||
//Futhermore, password must be loaded throught env | ||
//variables. | ||
// | ||
//We could even do it with the mandrillapp api that | ||
//we added for #34 | ||
$config['protocol'] = "smtp"; | ||
$config['smtp_host'] = "smtp.mandrillapp.com"; | ||
$config['smtp_port'] = "587"; | ||
$config['smtp_user'] = "[email protected]"; | ||
$config['smtp_pass'] = "pUOMLUusBKdoR604DpcOnQ"; | ||
$config['charset'] = "utf-8"; | ||
$config['mailtype'] = "html"; | ||
$config['newline'] = "\r\n"; | ||
|
||
$this->email->initialize($config); | ||
|
||
$this->email->from('[email protected]', 'Toolwatch contact'); | ||
$this->email->to('[email protected]', 'Marc'); | ||
$this->email->reply_to($email, $name); | ||
|
||
$this->email->subject('Contact Toolwatch from '.$name); | ||
|
||
$bodyMessage = '<b>Name :</b> '.$name.'<br>'; | ||
$bodyMessage .= '<b>Email :</b> '.$email.'<br>'; | ||
$bodyMessage .= '<b>Message :</b> <br>'; | ||
$bodyMessage .= $message; | ||
|
||
$this->email->message($bodyMessage); | ||
|
||
if ($this->email->send()) { | ||
$this->load->library('mandrill'); | ||
|
||
$messageMandrill = array( | ||
'html' => $message, | ||
'subject' => $subject, | ||
'from_email' => $email, | ||
'from_name' => $name, | ||
'to' => array( | ||
array( | ||
'email' => '[email protected]', | ||
'name' => 'Marc', | ||
'type' => 'to', | ||
) | ||
), | ||
'headers' => array( | ||
'Reply-To' => $email, | ||
), | ||
'important' => false, | ||
'track_opens' => true, | ||
'track_clicks' => true, | ||
'tags' => array($tags), | ||
'google_analytics_campaign' => $tags, | ||
'google_analytics_domains' => array('toolwatch.io'), | ||
'metadata' => array( | ||
'website' => 'toolwatch.io', | ||
) | ||
); | ||
|
||
$async = false; | ||
$ip_pool = 'Main Pool'; | ||
|
||
$scheduleTime = time(); | ||
|
||
$send_at = date('Y-', $scheduleTime).date('m-', $scheduleTime) | ||
.(date('d', $scheduleTime)).' '.(date('H', $scheduleTime)-1).':' | ||
.(date('i', $scheduleTime)).date(':s', $scheduleTime); | ||
|
||
$mandrillResponse = $this->mandrill->messages->send($messageMandrill, $async, $ip_pool, $send_at); | ||
log_message('info', 'Mandrill email: ' . print_r($mandrillResponse, true)); | ||
|
||
|
||
if ($mandrillResponse[0]['status'] === 'sent') { | ||
$result['success'] = true; | ||
} else { | ||
$result['success'] = false; | ||
|
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Empty file.