57 lines
1.4 KiB
SQL
57 lines
1.4 KiB
SQL
-- Setup Mailtrap SMTP Configuration in Database
|
|
-- This script configures the notification_delivery_config table with Mailtrap settings
|
|
|
|
-- Insert or update Mailtrap configuration for email channel
|
|
INSERT INTO notification_delivery_config
|
|
(channel_type, is_enabled, provider, provider_config, status, success_rate, created_by, updated_by, created_at, updated_at)
|
|
VALUES (
|
|
'email',
|
|
true,
|
|
'Mailtrap',
|
|
JSON_OBJECT(
|
|
'host', 'live.smtp.mailtrap.io',
|
|
'port', 587,
|
|
'secure', false,
|
|
'user', 'apismtp@mailtrap.io',
|
|
'pass', '8ec4d16f282740da5ddfc7ef7a3ca87b',
|
|
'senderEmail', 'noreply@yourcompany.com',
|
|
'senderName', 'Your Company Name'
|
|
),
|
|
'Active',
|
|
0.0,
|
|
1,
|
|
1,
|
|
NOW(),
|
|
NOW()
|
|
)
|
|
ON DUPLICATE KEY UPDATE
|
|
is_enabled = true,
|
|
provider = 'Mailtrap',
|
|
provider_config = JSON_OBJECT(
|
|
'host', 'live.smtp.mailtrap.io',
|
|
'port', 587,
|
|
'secure', false,
|
|
'user', 'apismtp@mailtrap.io',
|
|
'pass', '8ec4d16f282740da5ddfc7ef7a3ca87b',
|
|
'senderEmail', 'noreply@yourcompany.com',
|
|
'senderName', 'Your Company Name'
|
|
),
|
|
status = 'Active',
|
|
updated_by = 1,
|
|
updated_at = NOW();
|
|
|
|
-- Verify the configuration
|
|
SELECT
|
|
id,
|
|
channel_type,
|
|
is_enabled,
|
|
provider,
|
|
status,
|
|
JSON_EXTRACT(provider_config, '$.host') as smtp_host,
|
|
JSON_EXTRACT(provider_config, '$.port') as smtp_port,
|
|
JSON_EXTRACT(provider_config, '$.user') as smtp_user,
|
|
created_at,
|
|
updated_at
|
|
FROM notification_delivery_config
|
|
WHERE channel_type = 'email';
|