Skip to content
This repository has been archived by the owner on Nov 2, 2020. It is now read-only.

Commit

Permalink
fix(Email): Fix Email Can't Send
Browse files Browse the repository at this point in the history
Signed-off-by: Rhilip <rhilipruan@gmail.com>
  • Loading branch information
Rhilip committed Jun 7, 2019
1 parent f830f22 commit 5e5634e
Show file tree
Hide file tree
Showing 8 changed files with 12 additions and 11 deletions.
1 change: 1 addition & 0 deletions CHANGELOG.md
Original file line number Diff line number Diff line change
Expand Up @@ -36,6 +36,7 @@
- **Invite:** Add Fine-grained control of recycle pending
- **Register:** Add captcha checker
- **Tracker:** Add miss port check for field ipv6_port
- **View:** Fix Conversion::setDefault()
- **View:** remove view helper function `get_torrent_uploader_id`
- **View:** Fix view function redeclare

Expand Down
2 changes: 1 addition & 1 deletion apps/libraries/Mailer.php
Original file line number Diff line number Diff line change
Expand Up @@ -32,7 +32,7 @@ class Mailer extends BaseObject
/** @var PHPMailer */
public $_mailer;

public function onConstruct()
public function onInitialize()
{
$mail = new PHPMailer(true);

Expand Down
2 changes: 1 addition & 1 deletion apps/models/form/UserConfirmForm.php
Original file line number Diff line number Diff line change
Expand Up @@ -104,7 +104,7 @@ public function flush_recover() {
'username' => $this->username,
'password' => $new_password,
]);
$mail_sender = \apps\Libraries\Mailer::newInstanceByConfig('libraries.[mailer]');
$mail_sender = \apps\libraries\Mailer::newInstanceByConfig('libraries.[mailer]');
$mail_sender->send([$this->email], 'New Password', $mail_body);

return true;
Expand Down
2 changes: 1 addition & 1 deletion apps/models/form/UserInviteForm.php
Original file line number Diff line number Diff line change
Expand Up @@ -151,7 +151,7 @@ public function flush()
'username' => $this->username,
'invite_link' => $this->invite_link,
]);
$mail_sender = \apps\Libraries\Mailer::newInstanceByConfig('libraries.[mailer]');
$mail_sender = \apps\libraries\Mailer::newInstanceByConfig('libraries.[mailer]');
$mail_sender->send([$this->email], 'Invite To RidPT', $mail_body);
}
return $invite_status;
Expand Down
2 changes: 1 addition & 1 deletion apps/models/form/UserRecoverForm.php
Original file line number Diff line number Diff line change
Expand Up @@ -68,7 +68,7 @@ public function flush() {
'username' => $user_info['username'],
'confirm_url' => $confirm_url,
]);
$mail_sender = \apps\Libraries\Mailer::newInstanceByConfig('libraries.[mailer]');
$mail_sender = \apps\libraries\Mailer::newInstanceByConfig('libraries.[mailer]');
$mail_sender->send([$this->email], 'Please confirm your action to recover your password', $mail_body);
}
return true;
Expand Down
2 changes: 1 addition & 1 deletion apps/models/form/UserRegisterForm.php
Original file line number Diff line number Diff line change
Expand Up @@ -293,7 +293,7 @@ public function flush()
'username' => $this->username,
'confirm_url' => $confirm_url,
]);
$mail_sender = \apps\Libraries\Mailer::newInstanceByConfig('libraries.[mailer]');
$mail_sender = \apps\libraries\Mailer::newInstanceByConfig('libraries.[mailer]');
$mail_sender->send([$this->email], 'Please confirm your accent', $mail_body);
}

Expand Down
9 changes: 5 additions & 4 deletions apps/task/CronTabTimer.php
Original file line number Diff line number Diff line change
Expand Up @@ -95,11 +95,12 @@ protected function clean_expired_session() {

// TODO sync sessions from database to redis to avoid lost (Maybe)...

protected function expired_invitee () {
app()->pdo->createCommand('UPDATE `invite` SET `used` = -1 WHERE `expire_at` < NOW() AND `used` = 0')->execute();



protected function expired_temporarily_invites() {
app()->pdo->createCommand('UPDATE `user_invitations` SET `used` = `total` WHERE expire_at > NOW() AND `total` != `used`');
$count = app()->pdo->getRowCount();
$this->print_log('Success Expired ' . $count . ' Temporarily invites');
$this->print_log('Success Expired ' . $count . ' invites');
}

}
3 changes: 1 addition & 2 deletions apps/views/email/layout.php
Original file line number Diff line number Diff line change
Expand Up @@ -75,8 +75,7 @@
<div style="color:#555555;line-height:150%;padding: 15px 10px 10px;font-size: 14px; text-align: left; margin: 0;">
<?= $this->section('body') ?>
<hr>
Time: <?= date('Y-m-d H:i:s'); ?>
IP: <?= app()->request->getClientIp(); ?>
Action at <?= date('Y-m-d H:i:s'); ?> From IP: <?= app()->request->getClientIp(); ?>
</div>
</div>
</div>
Expand Down

0 comments on commit 5e5634e

Please sign in to comment.