This commit is contained in:
dignajar 2016-05-07 00:22:48 -03:00
parent 5f37660496
commit 12f8de5da8
3 changed files with 14 additions and 9 deletions

View File

@ -45,6 +45,7 @@ function checkPost($args)
$sent = Email::send(array( $sent = Email::send(array(
'from'=>$Site->emailFrom(), 'from'=>$Site->emailFrom(),
'fromName'=>$Site->title(),
'to'=>$email, 'to'=>$email,
'subject'=>$subject, 'subject'=>$subject,
'message'=>$message 'message'=>$message

View File

@ -82,9 +82,6 @@ define('NO_PARENT_CHAR', '3849abb4cb7abd24c2d8dac17b216f17');
// Post per page on Manage->Posts // Post per page on Manage->Posts
define('POSTS_PER_PAGE_ADMIN', 10); define('POSTS_PER_PAGE_ADMIN', 10);
// Check if JSON encode and decode are enabled.
// define('JSON', function_exists('json_encode'));
// Cli mode status for new posts/pages // Cli mode status for new posts/pages
define('CLI_MODE', true); define('CLI_MODE', true);

View File

@ -5,31 +5,38 @@ class Email {
// Returns TRUE if the mail was successfully accepted for delivery, FALSE otherwise. // Returns TRUE if the mail was successfully accepted for delivery, FALSE otherwise.
public static function send($args) public static function send($args)
{ {
// Current time in unixtimestamp
$now = time(); $now = time();
// Domain
$domainParse = parse_url(DOMAIN);
$headers = array(); $headers = array();
$headers[] = 'MIME-Version: 1.0'; $headers[] = 'MIME-Version: 1.0';
$headers[] = 'Content-type: text/html; charset=utf-8'; $headers[] = 'Content-type: text/html; charset=utf-8';
$headers[] = 'Content-Transfer-Encoding: 8bit';
$headers[] = 'From: '.$args['from']; $headers[] = 'From: =?UTF-8?B?'.base64_encode($args['fromName']).'?= <'.$args['from'].'>';
$headers[] = 'Reply-To: '.$args['from']; $headers[] = 'Reply-To: '.$args['from'];
$headers[] = 'Return-Path: '.$args['from']; $headers[] = 'Return-Path: '.$args['from'];
$headers[] = 'message-id: <'.$now.'webmaster@'.DOMAIN.'>'; $headers[] = 'message-id: <'.$now.'webmaster@'.$domainParse['host'].'>';
$headers[] = 'X-Mailer: PHP/'.phpversion(); $headers[] = 'X-Mailer: PHP/'.phpversion();
$subject = '=?UTF-8?B?'.base64_encode($args['subject']).'?=';
$message = '<html> $message = '<html>
<head> <head>
<meta charset="UTF-8">
<title>BLUDIT</title> <title>BLUDIT</title>
</head> </head>
<body style="background-color: #f1f1f1;"> <body>
<div style="margin: 0px auto; padding: 10px; font-size: 14px; width: 70%; max-width: 600px;"> <div>
<div style="font-size: 26px;">BLUDIT</div>
'.$args['message'].' '.$args['message'].'
</div> </div>
</body> </body>
</html>'; </html>';
return mail($args['to'], $args['subject'], $message, implode(PHP_EOL, $headers)); return mail($args['to'], $subject, $message, implode(PHP_EOL, $headers));
} }
} }