aboutsummaryrefslogtreecommitdiff
path: root/config.php.example
blob: 9ded2800ca745ac19bef3e08e2378668b4c30b52 (plain) (blame)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
<?php
// Example config.php
/* Database credentials. Assuming you are running MySQL
server with default setting (user 'root' with no password) */
define('DB_SERVER', 'hostname');
define('DB_USERNAME', 'username');
define('DB_PASSWORD', 'password');
define('DB_NAME', 'dbname');

define('MAIL_SERVER', 'mail.example.com');
define('MAIL_PORT', 587);
define('MAIL_USER', 'user');
define('MAIL_PASSWORD', 'password');
define('MAIL_FROM', 'system@example.com');

define('ANNOUNCE_MAIL', 'announce@example.com');
define('ANNOUNCE_DISCORD', 'https://discord.com/api/webhooks/thing');
define('ANNOUNCE_IRCSERVER', 'irc.example.com');
define('ANNOUNCE_IRCCHANNEL', '#example');
define('ANNOUNCE_NNTPSERVER', 'news.example.com');
define('ANNOUNCE_NNTPUSER', 'user');
define('ANNOUNCE_NNTPPASS', 'password');
define('ANNOUNCE_NNTPGROUP', 'misc.test');

define('DOMAIN', 'dash.example.com');
 
/* Attempt to connect to MySQL database */
$link = mysqli_connect(DB_SERVER, DB_USERNAME, DB_PASSWORD, DB_NAME);
 
// Check connection
if($link === false){
    die("ERROR: Could not connect. " . mysqli_connect_error());
}

require("/usr/share/php/libphp-phpmailer/autoload.php");
use PHPMailer\PHPMailer\PHPMailer;
use PHPMailer\PHPMailer\SMTP;

$mailer = null;
function new_mail() {
    $mailer = new PHPMailer();
    $mailer->isSMTP();
    $mailer->Host = MAIL_SERVER;
    $mailer->Port = MAIL_PORT;
    $mailer->SMTPAuth = true;
    $mailer->Username = MAIL_USER;
    $mailer->Password = MAIL_PASSWORD;
    $mailer->setFrom(MAIL_FROM);
    $mailer->isHTML(false);
}

new_mail();

?>