email styling
This commit is contained in:
parent
a580f459e6
commit
af6a8e0e91
|
@ -14,7 +14,7 @@ function getLatestActiveThreads()
|
|||
$limit = strtotime("3 days ago");
|
||||
}
|
||||
// Run the Query
|
||||
$query = "SELECT `".MYBB_PREFIX."forums`.`name` AS `forumname`,
|
||||
$query = "SELECT DISTINCT `".MYBB_PREFIX."forums`.`name` AS `forumname`,
|
||||
`".MYBB_PREFIX."threads`.`subject`,
|
||||
`".MYBB_PREFIX."threads`.`lastpost`,
|
||||
`".MYBB_PREFIX."threads`.`username`,
|
||||
|
|
12
digest.php
12
digest.php
|
@ -5,6 +5,7 @@ require_once "email.php";
|
|||
define("MYBB_ROOT", "../");
|
||||
define("MYBB_PREFIX", "mybbfo_");
|
||||
define("FORUM_ID", 0);// 0 means all forums
|
||||
define("DRY_RUN", true);
|
||||
$dsn = 'mysql:host=localhost;dbname=mybb;charset=utf8';
|
||||
$usr = 'root';
|
||||
$pwd = '123456';
|
||||
|
@ -37,10 +38,15 @@ $mailer = Swift_Mailer::newInstance($transport);
|
|||
foreach ($users as $user) {
|
||||
$email = $user['email'];
|
||||
$message = print_email($user['username'], $url.'/unsubscribe', $threads);
|
||||
if (DRY_RUN) {
|
||||
echo $message;
|
||||
}
|
||||
$message = Swift_Message::newInstance()
|
||||
->setSubject('Daily digest')
|
||||
->setFrom(array('john@doe.com' => 'John Doe'))
|
||||
->setSubject('Daily Digest — Olympic Business Forum')
|
||||
->setFrom('no-reply@olympicbusinessforum.com')
|
||||
->setTo(array($email => $user['username']))
|
||||
->setBody($message, 'text/html');
|
||||
$mailer->send($message);
|
||||
if (!DRY_RUN) {
|
||||
$mailer->send($message);
|
||||
}
|
||||
}
|
||||
|
|
|
@ -1,4 +1,5 @@
|
|||
<?php
|
||||
define(DATE_FORMAT, 'd/M/Y h:i A');
|
||||
function print_email($username, $unsubscription, $threads) {
|
||||
$message = <<<END
|
||||
<!DOCTYPE HTML PUBLIC "-//W3C//DTD HTML 4.01//EN" "http://www.w3.org/TR/html4/strict.dtd">
|
||||
|
@ -7,7 +8,7 @@ function print_email($username, $unsubscription, $threads) {
|
|||
<head>
|
||||
<title>Daily digest from Olympic Business Forum</title>
|
||||
</head>
|
||||
<body>
|
||||
<body style="font-family: Arial, Helvetica, sans-serif;font-size: 11pt;">
|
||||
<p>$username,</p>
|
||||
|
||||
<p>Here’s a daily update of activity on the Olympic Business forum.</p>
|
||||
|
@ -29,12 +30,12 @@ END;
|
|||
<td style="padding: 0.5em">'.$thread['subject'].'</td>
|
||||
<td style="padding: 0.5em">'.
|
||||
$thread['username'].', '.
|
||||
date('d.m.Y H:m:i', $thread['dateline']).'
|
||||
date(DATE_FORMAT, $thread['dateline']).'
|
||||
</td>
|
||||
<td style="padding: 0.5em">'.$thread['replies'].'</td>
|
||||
<td style="padding: 0.5em">'.
|
||||
$thread['lastposter'].', '.
|
||||
date('d.m.Y H:m:i', $thread['lastpost']).'
|
||||
date(DATE_FORMAT, $thread['lastpost']).'
|
||||
</td>
|
||||
</tr>
|
||||
';
|
||||
|
|
Reference in a new issue