Navigation Menu

Skip to content

Commit

Permalink
Merge branch 'master' of https://github.com/gresakg/PHaiku
Browse files Browse the repository at this point in the history
  • Loading branch information
gresakg committed May 15, 2014
2 parents 2fbc4c5 + e100e2d commit d4c385a
Showing 1 changed file with 21 additions and 8 deletions.
29 changes: 21 additions & 8 deletions PHaiku/Haiku.php
Expand Up @@ -160,19 +160,32 @@ protected function processForm() {
$this->data['form']->message = $message;
}
else {
$to = $this->app->config("contact.mail");
$subject = $this->data['form']->email_subject.$name;
$headers = 'From:'.$name. "<".$eadr.">" . "\r\n" .
'Reply-To:'. $to . "\r\n" .
'MIME-Version: 1.0' . "\r\n" .
'Content-Type: text/plain; format=flowed; charset="utf-8"; reply-type=response' . "\r\n" .
'X-Mailer: PHP/' . phpversion();
$filename = $this->getFilepath("contacts","csv");
$h = fopen($filename, "a");
$line = '"'.$name.'","'.$eadr.'","'.addslashes($message).'";'."\n";
fwrite($h,$line);
fclose($h);
mail($to,$subject,wordwrap($message, 70, "\r\n"),$headers);

require_once 'Mail.php';
$from = $name. "<".$eadr.">";
$to = $this->app->config("contact.mail");
$subject = $this->data['form']->email_subject.$name;
$body = $message;
$host = $this->app->config("mail.host");
$username = $this->app->config("mail.username");
$password = $this->app->config("mail.password");

$headers = array ('From' => $from,
'To' => $to,
'Subject' => $subject);
$smtp = \Mail::factory('smtp',
array ('host' => $host,
'auth' => true,
'username' => $username,
'password' => $password));

$mail = $smtp->send($to, $headers, $body);

$this->app->redirect($this->setUrl("contactok"));
}
}
Expand Down

0 comments on commit d4c385a

Please sign in to comment.