Sindbad~EG File Manager
-- Check if email_settings table exists and show its structure
SHOW TABLES LIKE 'email_settings';
-- Show the structure of email_settings table if it exists
DESCRIBE email_settings;
-- If table doesn't exist or has wrong structure, drop and recreate
DROP TABLE IF EXISTS email_settings;
DROP TABLE IF EXISTS email_queue;
-- Create email_settings table with correct structure
CREATE TABLE email_settings (
id INT AUTO_INCREMENT PRIMARY KEY,
smtp_host VARCHAR(255) NOT NULL DEFAULT 'localhost',
smtp_port INT NOT NULL DEFAULT 587,
smtp_username VARCHAR(255) DEFAULT NULL,
smtp_password VARCHAR(255) DEFAULT NULL,
smtp_encryption ENUM('none', 'tls', 'ssl') DEFAULT 'tls',
from_email VARCHAR(255) NOT NULL DEFAULT 'noreply@localhost',
from_name VARCHAR(255) NOT NULL DEFAULT 'Church Management System',
send_welcome_user TINYINT(1) DEFAULT 1,
send_welcome_member TINYINT(1) DEFAULT 1,
user_welcome_subject VARCHAR(255) DEFAULT 'Welcome to our Church Management System',
user_welcome_template TEXT DEFAULT NULL,
member_welcome_subject VARCHAR(255) DEFAULT 'Welcome to our Church Community',
member_welcome_template TEXT DEFAULT NULL,
is_enabled TINYINT(1) DEFAULT 0,
created_at TIMESTAMP DEFAULT CURRENT_TIMESTAMP,
updated_at TIMESTAMP DEFAULT CURRENT_TIMESTAMP ON UPDATE CURRENT_TIMESTAMP
);
-- Create email_queue table
CREATE TABLE email_queue (
id INT AUTO_INCREMENT PRIMARY KEY,
recipient_email VARCHAR(255) NOT NULL,
recipient_name VARCHAR(255) DEFAULT NULL,
subject VARCHAR(255) NOT NULL,
body TEXT NOT NULL,
email_type ENUM('user_welcome', 'member_welcome', 'general') DEFAULT 'general',
status ENUM('pending', 'sent', 'failed') DEFAULT 'pending',
attempts INT DEFAULT 0,
error_message TEXT DEFAULT NULL,
sent_at TIMESTAMP NULL DEFAULT NULL,
created_at TIMESTAMP DEFAULT CURRENT_TIMESTAMP,
updated_at TIMESTAMP DEFAULT CURRENT_TIMESTAMP ON UPDATE CURRENT_TIMESTAMP
);
-- Insert default email settings
INSERT INTO email_settings (
smtp_host, smtp_port, from_email, from_name,
user_welcome_subject, user_welcome_template,
member_welcome_subject, member_welcome_template
) VALUES (
'localhost', 587, 'noreply@localhost', 'Church Management System',
'Welcome to our Church Management System',
'<h2>Welcome to our Church Management System!</h2>
<p>Dear {name},</p>
<p>Your user account has been successfully created. You can now access the system using your credentials.</p>
<p><strong>Login Details:</strong></p>
<ul>
<li>Email: {email}</li>
<li>Username: {username}</li>
</ul>
<p>Please visit <a href="{login_url}">our login page</a> to access your account.</p>
<p>If you have any questions, please don''t hesitate to contact us.</p>
<p>Best regards,<br>Church Management Team</p>',
'Welcome to our Church Community',
'<h2>Welcome to our Church Community!</h2>
<p>Dear {name},</p>
<p>We are delighted to welcome you as a new member of our church community!</p>
<p><strong>Member Details:</strong></p>
<ul>
<li>Name: {name}</li>
<li>Member ID: {member_id}</li>
<li>Email: {email}</li>
</ul>
<p>We look forward to seeing you at our services and events. If you have any questions or need assistance, please feel free to reach out to us.</p>
<p>Blessings,<br>Church Leadership Team</p>'
);
Sindbad File Manager Version 1.0, Coded By Sindbad EG ~ The Terrorists