-- Add email_sent column to contact_replies table
ALTER TABLE contact_replies ADD COLUMN email_sent BOOLEAN DEFAULT FALSE AFTER replied_by;

-- Insert default mail settings if they don't exist
INSERT IGNORE INTO settings (setting_key, setting_value, setting_type, description, is_public) VALUES
('mail_enabled', '0', 'boolean', 'Enable/disable email functionality', 0),
('mail_smtp_host', '', 'string', 'SMTP server hostname', 0),
('mail_smtp_port', '587', 'integer', 'SMTP server port (587 for TLS, 465 for SSL)', 0),
('mail_smtp_username', '', 'string', 'SMTP username/email', 0),
('mail_smtp_password', '', 'string', 'SMTP password', 0),
('mail_smtp_encryption', 'tls', 'string', 'SMTP encryption type (tls, ssl, or none)', 0),
('mail_from_name', 'ParallelPx Admin', 'string', 'Email sender name', 0),
('mail_from_email', 'admin@parallelpx.com', 'string', 'Email sender address', 0);