Добро пожаловать в проект «Диспетчер задач»! Это приложение позволяет пользователям управлять своими задачами и получать напоминания по электронной почте о задачах, запланированных на день. Он построен с использованием PHP, MySQL и PHPMailer.
Клонируем репозиторий :
git clone https://github.com/faezedrx/task-manager-php.git
cd task-manager-php
Установить зависимости :
composer require phpmailer/phpmailer
Настроить базу данных :
bamboos1_services_portf.sql
из репозитория.config.php
, указав учетные данные вашей базы данных.Настройте параметры электронной почты :
email.php
, указав данные вашего SMTP-сервера. Запустите приложение :
Аутентификация пользователя :
Управление задачами :
Напоминания по электронной почте обрабатываются PHPMailer. Убедитесь, что настройки SMTP в email.php
настроены правильно:
<?php
require ' PHPMailer/src/Exception.php ' ;
require ' PHPMailer/src/PHPMailer.php ' ;
require ' PHPMailer/src/SMTP.php ' ;
use PHPMailer PHPMailer PHPMailer ;
use PHPMailer PHPMailer Exception ;
// require 'vendor/autoload.php';
class Mail {
private static $ instance = null ;
private $ mail ;
private function __construct () {
$ this -> mail = new PHPMailer ( true );
$ this -> configureSMTP ();
}
private function configureSMTP () {
// تنظیمات سرور SMTP
$ this -> mail -> isSMTP ();
$ this -> mail -> Host = ' your-smtp-server ' ;
$ this -> mail -> SMTPAuth = true ;
$ this -> mail -> Username = ' [email protected] ' ;
$ this -> mail -> Password = ' your-email-password ' ;
$ this -> mail -> SMTPSecure = PHPMailer:: ENCRYPTION_STARTTLS ;
$ this -> mail -> Port = 587 ;
}
public static function getInstance () {
if ( self :: $ instance == null ) {
self :: $ instance = new Mail ();
}
return self :: $ instance ;
}
public function getMailer () {
return $ this -> mail ;
}
}
function sendEmail ( $ to , $ subject , $ body ) {
$ mailInstance = Mail:: getInstance ()-> getMailer ();
try {
// تنظیمات گیرنده
$ mailInstance -> setFrom ( ' [email protected] ' , ' Task Management ' );
$ mailInstance -> addAddress ( $ to );
// تنظیمات محتوا
$ mailInstance -> isHTML ( true );
$ mailInstance -> Subject = $ subject ;
$ mailInstance -> Body = $ body ;
// ارسال ایمیل
$ mailInstance -> send ();
return true ;
} catch ( Exception $ e ) {
error_log ( " Email could not be sent. Mailer Error: { $ mailInstance -> ErrorInfo }" );
return false ;
}
}
?>
Вклады приветствуются! Пожалуйста, создайте запрос на включение или откройте проблему, чтобы обсудить любые изменения.
Если у вас есть какие-либо вопросы или вам нужна дополнительная помощь, свяжитесь с нами по электронной почте: [email protected].