bludit/bl-kernel/helpers/email.class.php

35 lines
956 B
PHP
Raw Normal View History

2015-08-03 02:49:12 +02:00
<?php defined('BLUDIT') or die('Bludit CMS.');
2015-03-08 18:02:59 +01:00
class Email {
2015-10-19 00:45:58 +02:00
// Returns TRUE if the mail was successfully accepted for delivery, FALSE otherwise.
2015-03-08 18:02:59 +01:00
public static function send($args)
{
2016-02-26 16:32:18 +01:00
$now = time();
2015-10-19 00:45:58 +02:00
$headers = array();
$headers[] = 'MIME-Version: 1.0';
2015-10-20 05:14:28 +02:00
$headers[] = 'Content-type: text/html; charset=utf-8';
2016-02-26 16:32:18 +01:00
2015-10-19 00:45:58 +02:00
$headers[] = 'From: '.$args['from'];
2016-02-26 16:32:18 +01:00
$headers[] = 'Reply-To: '.$args['from'];
$headers[] = 'Return-Path: '.$args['from'];
$headers[] = 'message-id: <'.$now.'webmaster@'.DOMAIN.'>';
2015-10-19 00:45:58 +02:00
$headers[] = 'X-Mailer: PHP/'.phpversion();
2015-03-08 18:02:59 +01:00
$message = '<html>
2015-08-03 02:49:12 +02:00
<head>
2015-10-20 05:14:28 +02:00
<title>BLUDIT</title>
2015-08-03 02:49:12 +02:00
</head>
<body style="background-color: #f1f1f1;">
<div style="margin: 0px auto; padding: 10px; font-size: 14px; width: 70%; max-width: 600px;">
<div style="font-size: 26px;">BLUDIT</div>
2015-10-20 05:14:28 +02:00
'.$args['message'].'
2015-08-03 02:49:12 +02:00
</div>
</body>
</html>';
2015-03-08 18:02:59 +01:00
2015-10-19 00:45:58 +02:00
return mail($args['to'], $args['subject'], $message, implode(PHP_EOL, $headers));
2015-03-08 18:02:59 +01:00
}
2016-01-17 22:11:20 +01:00
}