![]() Server : Apache/2 System : Linux server-15-235-50-60 5.15.0-164-generic #174-Ubuntu SMP Fri Nov 14 20:25:16 UTC 2025 x86_64 User : gositeme ( 1004) PHP Version : 8.2.29 Disable Function : exec,system,passthru,shell_exec,proc_close,proc_open,dl,popen,show_source,posix_kill,posix_mkfifo,posix_getpwuid,posix_setpgid,posix_setsid,posix_setuid,posix_setgid,posix_seteuid,posix_setegid,posix_uname Directory : /home/gositeme/domains/soundstudiopro.com/private_html/admin_includes/ |
<?php
// Email Management Tab
// This file handles email configuration and monitoring
// Include security functions
require_once __DIR__ . '/../includes/security.php';
// Enable error reporting for debugging (only in development)
if (defined('DEBUG_MODE') && DEBUG_MODE) {
error_reporting(E_ALL);
ini_set('display_errors', 1);
}
// Log that we're entering the email management file
error_log("Email management file loaded");
// Load database configuration
try {
require_once __DIR__ . '/../config/database.php';
$pdo = getDBConnection();
} catch (Exception $e) {
error_log("Failed to load database in email management: " . $e->getMessage());
$pdo = null;
}
// Get current email settings
$current_email_settings = [
'smtp_host' => defined('SMTP_HOST') ? SMTP_HOST : 'mail.soundstudiopro.com',
'smtp_port' => defined('SMTP_PORT') ? SMTP_PORT : 587,
'smtp_username' => defined('SMTP_USERNAME') ? SMTP_USERNAME : 'confirmation@soundstudiopro.com',
'smtp_password' => defined('SMTP_PASSWORD') ? '••••••••••••••••' : '••••••••••••••••',
'from_email' => defined('SMTP_FROM_EMAIL') ? SMTP_FROM_EMAIL : 'confirmation@soundstudiopro.com',
'from_name' => defined('SMTP_FROM_NAME') ? SMTP_FROM_NAME : 'SoundStudioPro'
];
// Handle form submissions
if (isset($_SERVER['REQUEST_METHOD']) && $_SERVER['REQUEST_METHOD'] === 'POST') {
error_log("Email management POST request received");
// Validate CSRF token
if (!validateCSRFToken($_POST['csrf_token'] ?? '')) {
error_log("CSRF token validation failed in email management");
$test_result = 'failed';
} elseif (isset($_POST['action'])) {
switch ($_POST['action']) {
case 'test_email':
error_log("Test email action triggered");
$test_email = validateEmail($_POST['test_email'] ?? '');
if ($test_email) {
error_log("Attempting to send test email to: " . $test_email);
try {
require_once __DIR__ . '/../config/email.php';
// Generate the actual order confirmation template for testing using the real function
$test_user_name = ucfirst(explode('@', $test_email)[0]);
$test_order_details = [
'cart_summary' => [
[
'type' => 'credit',
'name' => 'Starter Package',
'credits' => 10,
'quantity' => 1,
'amount' => 1999 // $19.99 in cents
]
],
'total_amount' => 1999
];
$test_billing_address = [
'billing_name' => $test_user_name,
'billing_email' => $test_email,
'billing_address' => '123 Test St',
'billing_city' => 'Test City',
'billing_state' => 'TS',
'billing_zip' => '12345',
'billing_country' => 'United States'
];
$order_email = generateOrderConfirmationEmail($test_user_name, $test_order_details, $test_billing_address);
$result = sendEmail(
$test_email,
$test_user_name,
$order_email['subject'],
$order_email['html'],
$order_email['text'],
'test_email'
);
$test_result = $result ? 'success' : 'failed';
error_log("Test email result: " . $test_result);
// Email activity is now logged to database via sendEmail function
} catch (Exception $e) {
error_log("Email test error: " . $e->getMessage());
$test_result = 'failed';
}
}
break;
case 'test_welcome_email':
error_log("Welcome email test action triggered");
$welcome_test_email = validateEmail($_POST['welcome_test_email'] ?? '');
if ($welcome_test_email) {
error_log("Attempting to send welcome email to: " . $welcome_test_email);
try {
require_once __DIR__ . '/../config/email.php';
// Send welcome email
$welcome_email = generateWelcomeEmail(ucfirst(explode('@', $welcome_test_email)[0]), $welcome_test_email, 5, 'Welcome123!');
$result = sendEmail(
$welcome_test_email,
ucfirst(explode('@', $welcome_test_email)[0]),
$welcome_email['subject'],
$welcome_email['html'],
$welcome_email['text'],
'welcome_email'
);
$test_result = $result ? 'success' : 'failed';
error_log("Welcome email test result: " . $test_result);
} catch (Exception $e) {
error_log("Welcome email test error: " . $e->getMessage());
$test_result = 'failed';
}
}
break;
case 'test_stephane_email':
error_log("Stéphane thank you email test action triggered");
$stephane_test_email = validateEmail($_POST['stephane_test_email'] ?? '');
if ($stephane_test_email) {
error_log("Attempting to send Stéphane thank you email to: " . $stephane_test_email);
try {
require_once __DIR__ . '/../config/email.php';
// Send Stéphane thank you email
$stephane_email = generateStephanThankYouEmail($stephane_test_email);
$result = sendEmail(
$stephane_test_email,
'Stéphane',
$stephane_email['subject'],
$stephane_email['html'],
$stephane_email['text'],
'stephane_thank_you'
);
$test_result = $result ? 'success' : 'failed';
error_log("Stéphane email test result: " . $test_result);
} catch (Exception $e) {
error_log("Stéphane email test error: " . $e->getMessage());
$test_result = 'failed';
$test_error_message = $e->getMessage();
}
} else {
error_log("Invalid email address provided for Stéphane test: " . ($_POST['stephane_test_email'] ?? 'empty'));
$test_result = 'failed';
$test_error_message = 'Invalid email address provided.';
}
break;
}
}
}
?>
<!-- Email Management Section -->
<div class="section-header">
<h2><i class="fas fa-envelope"></i> Email Management</h2>
<p>Configure and monitor email settings for order confirmations and notifications.</p>
</div>
<div class="settings-grid" style="display: grid; grid-template-columns: repeat(auto-fit, minmax(350px, 1fr)); gap: 2rem; margin-bottom: 3rem;">
<!-- Email Configuration -->
<div class="settings-card" style="background: rgba(255, 255, 255, 0.05); border-radius: 16px; padding: 2rem;">
<h3 style="margin-top: 0; color: white; font-size: 1.8rem;">
<i class="fas fa-cog"></i> Email Configuration
</h3>
<div class="email-info" style="background: rgba(102, 126, 234, 0.1); border: 1px solid rgba(102, 126, 234, 0.3); border-radius: 8px; padding: 1rem; margin-bottom: 1.5rem;">
<h4 style="color: #667eea; margin-top: 0;">Current SMTP Settings</h4>
<div style="color: #a0aec0; font-family: monospace; font-size: 0.9rem;">
<div><strong>SMTP Host:</strong> <?= htmlspecialchars($current_email_settings['smtp_host']) ?></div>
<div><strong>SMTP Port:</strong> <?= htmlspecialchars($current_email_settings['smtp_port']) ?></div>
<div><strong>Username:</strong> <?= htmlspecialchars($current_email_settings['smtp_username']) ?></div>
<div><strong>Password:</strong> <?= htmlspecialchars($current_email_settings['smtp_password']) ?></div>
<div><strong>From Email:</strong> <?= htmlspecialchars($current_email_settings['from_email']) ?></div>
<div><strong>From Name:</strong> <?= htmlspecialchars($current_email_settings['from_name']) ?></div>
</div>
</div>
<div class="email-credentials" style="background: rgba(34, 197, 94, 0.1); border: 1px solid rgba(34, 197, 94, 0.3); border-radius: 8px; padding: 1rem; margin-bottom: 1.5rem;">
<h4 style="color: #22c55e; margin-top: 0;">Email Account Details</h4>
<p style="color: #a0aec0; margin-bottom: 0.5rem;">Your email account has been configured:</p>
<div style="color: #a0aec0; font-family: monospace; font-size: 0.9rem;">
<div><strong>Email:</strong> confirmation@soundstudiopro.com</div>
<div><strong>Password:</strong> C3nGG9e5Dw7NRXuXLxwq</div>
<div><strong>POP/IMAP Server:</strong> mail.soundstudiopro.com</div>
<div><strong>SMTP Server:</strong> mail.soundstudiopro.com (port 587)</div>
</div>
</div>
<p style="color: #a0aec0; font-size: 0.9rem;">
<i class="fas fa-info-circle"></i>
Email configuration is managed in <code>config/email.php</code>.
Changes require server restart to take effect.
</p>
</div>
<!-- Email Testing -->
<div class="settings-card" style="background: rgba(255, 255, 255, 0.05); border-radius: 16px; padding: 2rem;">
<h3 style="margin-top: 0; color: white; font-size: 1.8rem;">
<i class="fas fa-paper-plane"></i> Test Email System
</h3>
<form method="POST" style="margin-bottom: 1.5rem;" onsubmit="console.log('Form submitted'); return true;">
<input type="hidden" name="csrf_token" value="<?= generateCSRFToken() ?>">
<input type="hidden" name="action" value="test_email">
<div class="setting-item" style="margin-bottom: 1.5rem;">
<label style="display: block; color: #a0aec0; margin-bottom: 0.5rem; font-weight: 600;">Test Email Address</label>
<input type="email" name="test_email" placeholder="Enter email to test" required
style="width: 100%; padding: 0.8rem; border: 1px solid rgba(255, 255, 255, 0.2); border-radius: 8px; background: rgba(255, 255, 255, 0.05); color: white;">
</div>
<button type="submit" class="btn btn-primary" style="width: 100%; margin-bottom: 1rem;">
<i class="fas fa-paper-plane"></i> Send Order Confirmation Test
</button>
</form>
<form method="POST" style="margin-bottom: 1.5rem;" onsubmit="console.log('Welcome email form submitted'); return true;">
<input type="hidden" name="csrf_token" value="<?= generateCSRFToken() ?>">
<input type="hidden" name="action" value="test_welcome_email">
<div class="setting-item" style="margin-bottom: 1.5rem;">
<label style="display: block; color: #a0aec0; margin-bottom: 0.5rem; font-weight: 600;">Welcome Email Test</label>
<input type="email" name="welcome_test_email" placeholder="Enter email to test welcome email" required
style="width: 100%; padding: 0.8rem; border: 1px solid rgba(255, 255, 255, 0.2); border-radius: 8px; background: rgba(255, 255, 255, 0.05); color: white;">
</div>
<button type="submit" class="btn btn-primary" style="width: 100%; background: linear-gradient(135deg, #f093fb, #f5576c);">
<i class="fas fa-star"></i> Send Welcome Email Test
</button>
</form>
<form method="POST" style="margin-bottom: 1.5rem;" onsubmit="console.log('Stéphane email form submitted'); return true;">
<input type="hidden" name="csrf_token" value="<?= generateCSRFToken() ?>">
<input type="hidden" name="action" value="test_stephane_email">
<div class="setting-item" style="margin-bottom: 1.5rem;">
<label style="display: block; color: #a0aec0; margin-bottom: 0.5rem; font-weight: 600;">Stéphane Thank You Email Test (French)</label>
<input type="email" name="stephane_test_email" placeholder="Enter email to test Stéphane thank you email" required
style="width: 100%; padding: 0.8rem; border: 1px solid rgba(255, 255, 255, 0.2); border-radius: 8px; background: rgba(255, 255, 255, 0.05); color: white;">
</div>
<button type="submit" class="btn btn-primary" style="width: 100%; background: linear-gradient(135deg, #667eea, #764ba2);">
<i class="fas fa-heart"></i> Send Stéphane Thank You Email Test
</button>
</form>
<?php if (isset($test_result)): ?>
<div class="test-result" style="padding: 1.5rem; border-radius: 8px; margin: 1.5rem 0; <?= $test_result === 'success' ? 'background: rgba(34, 197, 94, 0.2); border: 2px solid rgba(34, 197, 94, 0.5); color: #22c55e;' : 'background: rgba(239, 68, 68, 0.2); border: 2px solid rgba(239, 68, 68, 0.5); color: #ef4444;' ?>">
<div style="display: flex; align-items: center; margin-bottom: 0.5rem;">
<i class="fas fa-<?= $test_result === 'success' ? 'check-circle' : 'exclamation-circle' ?>" style="font-size: 1.5rem; margin-right: 0.5rem;"></i>
<strong style="font-size: 1.2rem;">Test Email <?= $test_result === 'success' ? 'Sent Successfully!' : 'Failed!' ?></strong>
</div>
<?php if ($test_result === 'success'): ?>
<?php if (isset($_POST['stephane_test_email'])): ?>
<p style="margin: 0.5rem 0 0 0; font-size: 1rem;">✅ Stéphane Thank You Email sent successfully to <?= htmlspecialchars($_POST['stephane_test_email'] ?? '') ?>!</p>
<p style="margin: 0.5rem 0 0 0; font-size: 0.9rem; color: #a0aec0;">Check your email inbox for the French thank you message.</p>
<?php elseif (isset($_POST['welcome_test_email'])): ?>
<p style="margin: 0.5rem 0 0 0; font-size: 1rem;">✅ Welcome Email sent successfully to <?= htmlspecialchars($_POST['welcome_test_email'] ?? '') ?>!</p>
<p style="margin: 0.5rem 0 0 0; font-size: 0.9rem; color: #a0aec0;">Check your email inbox for the inspirational welcome message.</p>
<?php else: ?>
<p style="margin: 0.5rem 0 0 0; font-size: 1rem;">✅ Order Confirmation template sent successfully to <?= htmlspecialchars($_POST['test_email'] ?? '') ?>!</p>
<p style="margin: 0.5rem 0 0 0; font-size: 0.9rem; color: #a0aec0;">Check your email inbox for the full template preview.</p>
<?php endif; ?>
<?php else: ?>
<p style="margin: 0.5rem 0 0 0; font-size: 1rem;">❌ Failed to send email. Check server logs for details.</p>
<?php if (isset($test_error_message)): ?>
<p style="margin: 0.5rem 0 0 0; font-size: 0.9rem; color: #ef4444;">Error: <?= htmlspecialchars($test_error_message) ?></p>
<?php endif; ?>
<?php endif; ?>
</div>
<?php endif; ?>
<!-- Debug Information -->
<div style="background: rgba(255, 255, 255, 0.05); border-radius: 8px; padding: 1rem; margin-top: 1rem; font-size: 0.9rem; color: #a0aec0;">
<strong>Debug Info:</strong><br>
Request Method: <?= $_SERVER['REQUEST_METHOD'] ?? 'NOT SET' ?><br>
Action: <?= $_POST['action'] ?? 'NOT SET' ?><br>
Test Email: <?= $_POST['test_email'] ?? 'NOT SET' ?><br>
Test Result: <?= $test_result ?? 'NOT SET' ?><br>
Session User ID: <?= $_SESSION['user_id'] ?? 'NOT SET' ?><br>
Session Is Admin: <?= $_SESSION['is_admin'] ?? 'NOT SET' ?><br>
</div>
<div class="email-templates" style="margin-top: 1.5rem;">
<h4 style="color: white; margin-bottom: 1rem;">Email Templates</h4>
<div style="color: #a0aec0; font-size: 0.9rem;">
<div style="margin-bottom: 0.5rem;">
<i class="fas fa-check-circle" style="color: #22c55e;"></i>
Order Confirmation Emails
</div>
<div style="margin-bottom: 0.5rem;">
<i class="fas fa-check-circle" style="color: #22c55e;"></i>
Credit Purchase Confirmations
</div>
<div style="margin-bottom: 0.5rem;">
<i class="fas fa-check-circle" style="color: #22c55e;"></i>
Track Purchase Confirmations
</div>
<div style="margin-bottom: 0.5rem;">
<i class="fas fa-check-circle" style="color: #22c55e;"></i>
Stéphane Thank You Email (French)
</div>
<div style="margin-bottom: 0.5rem;">
<i class="fas fa-clock" style="color: #f59e0b;"></i>
Credit Expiration Notifications (Coming Soon)
</div>
</div>
</div>
</div>
<!-- Email Statistics -->
<div class="settings-card" style="background: rgba(255, 255, 255, 0.05); border-radius: 16px; padding: 2rem;">
<h3 style="margin-top: 0; color: white; font-size: 1.8rem;">
<i class="fas fa-chart-bar"></i> Email Statistics
</h3>
<div class="email-stats" style="display: grid; grid-template-columns: 1fr 1fr; gap: 1rem; margin-bottom: 1.5rem;">
<div style="background: rgba(102, 126, 234, 0.1); border-radius: 8px; padding: 1rem; text-align: center;">
<div style="font-size: 2rem; font-weight: bold; color: #667eea;">✓</div>
<div style="color: #a0aec0; font-size: 0.9rem;">System Active</div>
</div>
<div style="background: rgba(34, 197, 94, 0.1); border-radius: 8px; padding: 1rem; text-align: center;">
<div style="font-size: 2rem; font-weight: bold; color: #22c55e;">4</div>
<div style="color: #a0aec0; font-size: 0.9rem;">Email Types</div>
</div>
</div>
<div class="email-logs" style="background: rgba(0, 0, 0, 0.2); border-radius: 8px; padding: 1rem;">
<h4 style="color: white; margin-top: 0; margin-bottom: 1rem;">Recent Email Activity</h4>
<div style="color: #a0aec0; font-size: 0.9rem; max-height: 200px; overflow-y: auto;">
<?php
// Get recent email logs from database
if ($pdo) {
try {
$stmt = $pdo->prepare("
SELECT id, recipient_email, subject, email_type, status, sent_at, error_message, order_id, user_id
FROM email_logs
ORDER BY sent_at DESC
LIMIT 10
");
$stmt->execute();
$email_logs = $stmt->fetchAll();
if ($email_logs) {
foreach ($email_logs as $log) {
$status_color = $log['status'] === 'sent' ? '#22c55e' : ($log['status'] === 'failed' ? '#ef4444' : '#f59e0b');
$status_icon = $log['status'] === 'sent' ? '✓' : ($log['status'] === 'failed' ? '✗' : '⏳');
echo '<div style="padding: 0.5rem 0; border-bottom: 1px solid rgba(255, 255, 255, 0.1); cursor: pointer;" onclick="window.location.href=\'/admin_view_email.php?id=' . $log['id'] . '\'" onmouseover="this.style.background=\'rgba(255, 255, 255, 0.05)\'" onmouseout="this.style.background=\'transparent\'">';
echo '<div style="display: flex; justify-content: space-between; align-items: center;">';
echo '<span style="color: ' . $status_color . ';">' . $status_icon . ' ' . htmlspecialchars($log['recipient_email']) . '</span>';
echo '<span style="font-size: 0.8rem; color: #6b7280;">' . date('M j, g:i A', strtotime($log['sent_at'])) . '</span>';
echo '</div>';
echo '<div style="font-size: 0.8rem; color: #6b7280;">' . htmlspecialchars($log['subject']) . ' (' . $log['email_type'] . ') <span style="color: #667eea; margin-left: 8px;">👁️ Click to view</span></div>';
if ($log['error_message']) {
echo '<div style="font-size: 0.8rem; color: #ef4444;">Error: ' . htmlspecialchars($log['error_message']) . '</div>';
}
echo '</div>';
}
} else {
echo '<div style="color: #6b7280;">No recent email activity logged.</div>';
}
} catch (Exception $e) {
echo '<div style="color: #ef4444;">Error loading email logs: ' . htmlspecialchars($e->getMessage()) . '</div>';
}
} else {
echo '<div style="color: #ef4444;">Database connection not available.</div>';
}
?>
</div>
</div>
</div>
<!-- Email Configuration Guide -->
<div class="settings-card" style="background: rgba(255, 255, 255, 0.05); border-radius: 16px; padding: 2rem;">
<h3 style="margin-top: 0; color: white; font-size: 1.8rem;">
<i class="fas fa-book"></i> Configuration Guide
</h3>
<div class="config-steps" style="color: #a0aec0;">
<div style="margin-bottom: 1rem; padding: 1rem; background: rgba(0, 0, 0, 0.2); border-radius: 8px;">
<h4 style="color: white; margin-top: 0;">1. Email Account Setup</h4>
<p style="margin-bottom: 0.5rem;">Your email account is already configured:</p>
<ul style="margin: 0; padding-left: 1.5rem;">
<li>Email: confirmation@soundstudiopro.com</li>
<li>Password: C3nGG9e5Dw7NRXuXLxwq</li>
<li>SMTP: mail.soundstudiopro.com:587</li>
</ul>
</div>
<div style="margin-bottom: 1rem; padding: 1rem; background: rgba(0, 0, 0, 0.2); border-radius: 8px;">
<h4 style="color: white; margin-top: 0;">2. Configuration File</h4>
<p style="margin-bottom: 0.5rem;">Settings are stored in <code>config/email.php</code></p>
<p style="margin-bottom: 0;">Current settings are active and working.</p>
</div>
<div style="margin-bottom: 1rem; padding: 1rem; background: rgba(0, 0, 0, 0.2); border-radius: 8px;">
<h4 style="color: white; margin-top: 0;">3. Testing</h4>
<p style="margin-bottom: 0.5rem;">Use the test email feature to verify configuration.</p>
<p style="margin-bottom: 0;">Check server logs for any issues.</p>
</div>
<div style="padding: 1rem; background: rgba(0, 0, 0, 0.2); border-radius: 8px;">
<h4 style="color: white; margin-top: 0;">4. Monitoring</h4>
<p style="margin-bottom: 0.5rem;">Monitor email activity and delivery rates.</p>
<p style="margin-bottom: 0;">Check spam folders if emails not received.</p>
</div>
</div>
</div>
</div>
<!-- Email Templates Preview -->
<div class="section-header" style="margin-top: 3rem;">
<h3><i class="fas fa-eye"></i> Email Template Previews</h3>
<p>Preview all your email templates before sending.</p>
</div>
<!-- Template Navigation -->
<div style="display: flex; gap: 1rem; margin-bottom: 2rem; background: rgba(255, 255, 255, 0.05); border-radius: 12px; padding: 1rem;">
<button onclick="showTemplate('order')" id="order-tab" class="template-tab active" style="flex: 1; padding: 12px; border: none; border-radius: 8px; background: #667eea; color: white; cursor: pointer; font-weight: bold;">
📋 Order Confirmation
</button>
<button onclick="showTemplate('welcome')" id="welcome-tab" class="template-tab" style="flex: 1; padding: 12px; border: none; border-radius: 8px; background: rgba(255, 255, 255, 0.1); color: #a0aec0; cursor: pointer; font-weight: bold;">
🌟 Welcome Email
</button>
</div>
<!-- Order Confirmation Template -->
<div id="order-template" class="template-preview active" style="background: rgba(255, 255, 255, 0.05); border-radius: 16px; padding: 2rem; margin-bottom: 2rem;">
<div style="max-width: 600px; margin: 0 auto; background: white; border-radius: 8px; overflow: hidden; box-shadow: 0 4px 20px rgba(0, 0, 0, 0.3);">
<div style="background: linear-gradient(135deg, #667eea, #764ba2); color: white; padding: 30px; text-align: center;">
<h1 style="margin: 0 0 10px 0; font-size: 2rem;">🎵 SoundStudioPro</h1>
<h2 style="margin: 0 0 10px 0; font-size: 1.5rem;">Order Confirmation</h2>
<div style="background: rgba(255, 255, 255, 0.2); padding: 10px 20px; border-radius: 5px; display: inline-block; margin: 10px 0;">
Order #SSP-20250725-EXAMPLE
</div>
<p style="margin: 0;">Thank you for your purchase!</p>
</div>
<div style="padding: 30px; color: #333;">
<p>Dear John Doe,</p>
<p>Thank you for your order! We're excited to confirm that your payment has been processed successfully.</p>
<h3>📋 Order Details</h3>
<table style="width: 100%; border-collapse: collapse; margin: 20px 0;">
<thead>
<tr style="background: #667eea; color: white;">
<th style="padding: 12px; text-align: left;">Item</th>
<th style="padding: 12px; text-align: center;">Qty</th>
<th style="padding: 12px; text-align: right;">Price</th>
</tr>
</thead>
<tbody>
<tr>
<td style="padding: 12px; border-bottom: 1px solid #e2e8f0;">Starter Package</td>
<td style="padding: 12px; border-bottom: 1px solid #e2e8f0; text-align: center;">1</td>
<td style="padding: 12px; border-bottom: 1px solid #e2e8f0; text-align: right;">$19.99</td>
</tr>
<tr style="font-weight: bold; background: #f1f5f9;">
<td colspan="2" style="padding: 12px; text-align: right;">Total:</td>
<td style="padding: 12px; text-align: right;">$19.99</td>
</tr>
</tbody>
</table>
<div style="background: #f8f9fa; padding: 20px; border-radius: 8px; margin: 20px 0; border-left: 4px solid #667eea;">
<h4>📍 Billing Information</h4>
<p><strong>Name:</strong> John Doe</p>
<p><strong>Email:</strong> john@example.com</p>
<p><strong>Address:</strong><br>123 Main St<br>Anytown, ST 12345<br>United States</p>
</div>
<h3>🎁 What's Next?</h3>
<p><strong>🎯 Credits Added:</strong> Your credits have been automatically added to your account and are ready to use for creating music!</p>
<div style="text-align: center; margin: 30px 0;">
<a href="https://soundstudiopro.com/dashboard.php" style="display: inline-block; background: #667eea; color: white; padding: 12px 24px; text-decoration: none; border-radius: 5px; margin: 10px 5px;">Go to Dashboard</a>
<a href="https://soundstudiopro.com/dashboard.php?tab=credits" style="display: inline-block; background: #667eea; color: white; padding: 12px 24px; text-decoration: none; border-radius: 5px; margin: 10px 5px;">View Credits</a>
</div>
<div style="text-align: center; margin-top: 30px; color: #666; font-size: 14px;">
<p>Thank you for choosing SoundStudioPro!</p>
<p>© 2025 SoundStudioPro.com - Empowering creators worldwide</p>
</div>
</div>
</div>
</div>
<!-- Welcome Email Template -->
<div id="welcome-template" class="template-preview" style="display: none; background: rgba(255, 255, 255, 0.05); border-radius: 16px; padding: 2rem; margin-bottom: 2rem;">
<div style="max-width: 600px; margin: 0 auto; background: white; border-radius: 8px; overflow: hidden; box-shadow: 0 4px 20px rgba(0, 0, 0, 0.3);">
<div style="background: linear-gradient(135deg, #667eea, #764ba2); color: white; padding: 40px 30px; text-align: center;">
<h1 style="margin: 0 0 10px 0; font-size: 2.5rem;">🎵 SoundStudioPro</h1>
<div style="background: rgba(255, 255, 255, 0.2); padding: 15px 30px; border-radius: 25px; display: inline-block; margin: 20px 0; font-size: 18px; font-weight: bold;">Welcome to the Family!</div>
<p style="font-size: 18px; margin: 0;">Your musical journey begins now</p>
</div>
<div style="padding: 40px 30px; color: #333;">
<h2 style="color: #667eea; text-align: center; margin-bottom: 30px;">Dear Test User,</h2>
<div style="background: linear-gradient(135deg, #f093fb, #f5576c); color: white; padding: 30px; border-radius: 15px; margin: 30px 0; text-align: center;">
<h3 style="margin: 0 0 15px 0; font-size: 24px;">🌟 Welcome to Your Creative Sanctuary</h3>
<p style="font-style: italic; font-size: 18px; margin: 20px 0;">"Music is the divine way to tell beautiful, poetic things to the heart."</p>
<p style="margin: 0; font-size: 16px;">You've just joined a community of creators, dreamers, and music lovers. Your unique voice has a place here.</p>
</div>
<p style="font-size: 16px; line-height: 1.8;">We're <span style="background: linear-gradient(120deg, #a8edea 0%, #fed6e3 100%); padding: 2px 6px; border-radius: 4px;">thrilled</span> to have you as part of the SoundStudioPro family! You've taken the first step towards turning your musical dreams into reality.</p>
<div style="background: linear-gradient(135deg, #4facfe, #00f2fe); color: white; padding: 25px; border-radius: 12px; margin: 25px 0; text-align: center;">
<h3 style="margin: 0 0 10px 0;">🎁 Your Welcome Gift</h3>
<p style="margin: 0; font-size: 18px;"><strong>5 Credits</strong> are waiting for you!</p>
<p style="margin: 10px 0 0 0; font-size: 14px;">Start creating your first masterpiece today</p>
</div>
<div style="background: #f8f9fa; padding: 25px; border-radius: 12px; margin: 25px 0; border-left: 4px solid #22c55e; border: 2px solid #22c55e;">
<h4 style="color: #22c55e; margin: 0 0 15px 0; font-size: 18px;">🔐 Your Login Credentials</h4>
<p style="margin: 0 0 15px 0; font-size: 16px; color: #333;">Please save these credentials in a secure location:</p>
<div style="background: white; padding: 20px; border-radius: 8px; border: 1px solid #e2e8f0;">
<div style="margin-bottom: 15px;">
<strong style="color: #667eea; font-size: 16px;">🌐 Website:</strong>
<p style="margin: 5px 0 0 0; font-size: 16px; color: #333;">https://soundstudiopro.com</p>
</div>
<div style="margin-bottom: 15px;">
<strong style="color: #667eea; font-size: 16px;">📧 Email:</strong>
<p style="margin: 5px 0 0 0; font-size: 16px; color: #333; font-family: monospace;">test@example.com</p>
</div>
<div style="margin-bottom: 15px;">
<strong style="color: #667eea; font-size: 16px;">🔑 Password:</strong>
<p style="margin: 5px 0 0 0; font-size: 16px; color: #333; font-family: monospace;">Welcome123!</p>
</div>
</div>
<p style="margin: 15px 0 0 0; font-size: 14px; color: #666; font-style: italic;">💡 Tip: Consider using a password manager for enhanced security</p>
</div>
<h3 style="color: #667eea; text-align: center; margin: 30px 0;">🚀 What Awaits You</h3>
<div style="display: grid; grid-template-columns: 1fr 1fr; gap: 20px; margin: 30px 0;">
<div style="background: #f8f9fa; padding: 20px; border-radius: 10px; text-align: center; border-left: 4px solid #667eea;">
<h4 style="color: #667eea; margin: 0 0 10px 0; font-size: 16px;">🎼 AI-Powered Creation</h4>
<p style="margin: 0; font-size: 15px; line-height: 1.5;">Transform your ideas into professional tracks</p>
</div>
<div style="background: #f8f9fa; padding: 20px; border-radius: 10px; text-align: center; border-left: 4px solid #667eea;">
<h4 style="color: #667eea; margin: 0 0 10px 0; font-size: 16px;">🎧 Premium Library</h4>
<p style="margin: 0; font-size: 15px; line-height: 1.5;">Access thousands of high-quality tracks</p>
</div>
<div style="background: #f8f9fa; padding: 20px; border-radius: 10px; text-align: center; border-left: 4px solid #667eea;">
<h4 style="color: #667eea; margin: 0 0 10px 0; font-size: 16px;">👥 Vibrant Community</h4>
<p style="margin: 0; font-size: 15px; line-height: 1.5;">Connect with fellow musicians</p>
</div>
<div style="background: #f8f9fa; padding: 20px; border-radius: 10px; text-align: center; border-left: 4px solid #667eea;">
<h4 style="color: #667eea; margin: 0 0 10px 0; font-size: 16px;">⚡ Instant Access</h4>
<p style="margin: 0; font-size: 15px; line-height: 1.5;">Start creating immediately</p>
</div>
</div>
<div style="text-align: center; margin: 40px 0;">
<a href="https://soundstudiopro.com/dashboard.php" style="display: inline-block; background: linear-gradient(135deg, #667eea, #764ba2); color: white; padding: 15px 30px; text-decoration: none; border-radius: 25px; margin: 15px 10px; font-weight: bold; font-size: 16px; box-shadow: 0 4px 15px rgba(102, 126, 234, 0.3);">🎯 Start Creating Now</a>
<a href="https://soundstudiopro.com/dashboard.php?tab=credits" style="display: inline-block; background: linear-gradient(135deg, #667eea, #764ba2); color: white; padding: 15px 30px; text-decoration: none; border-radius: 25px; margin: 15px 10px; font-weight: bold; font-size: 16px; box-shadow: 0 4px 15px rgba(102, 126, 234, 0.3);">💰 View My Credits</a>
</div>
<div style="background: #f8f9fa; padding: 25px; border-radius: 12px; margin: 30px 0; border-left: 4px solid #667eea;">
<h4 style="color: #667eea; margin: 0 0 15px 0; font-size: 18px;">🎵 Your First Steps</h4>
<ol style="margin: 0; padding-left: 20px; font-size: 16px; line-height: 1.6;">
<li style="margin-bottom: 12px;">Explore our <strong>AI Music Generator</strong> to create your first track</li>
<li style="margin-bottom: 12px;">Browse our <strong>Premium Music Library</strong> for inspiration</li>
<li style="margin-bottom: 12px;">Join our <strong>Community</strong> to connect with other artists</li>
<li style="margin-bottom: 12px;">Share your creations and get feedback from the community</li>
</ol>
</div>
<p style="font-size: 16px; text-align: center; color: #667eea; font-weight: bold; margin: 30px 0;">Remember: Every great artist started with a single note. Your masterpiece is waiting to be created! 🎼</p>
</div>
<div style="background: #1a1a1a; color: #ffffff; padding: 30px; text-align: center;">
<h3 style="margin: 0 0 20px 0; color: #667eea;">Stay Connected</h3>
<div style="margin: 20px 0;">
<a href="https://soundstudiopro.com" style="color: #667eea; margin: 0 10px; text-decoration: none;">🌐 Website</a> |
<a href="mailto:support@soundstudiopro.com" style="color: #667eea; margin: 0 10px; text-decoration: none;">📧 Support</a> |
<a href="https://soundstudiopro.com/community" style="color: #667eea; margin: 0 10px; text-decoration: none;">👥 Community</a>
</div>
<p style="margin: 20px 0 0 0; font-size: 14px; color: #a0aec0;">
Thank you for choosing SoundStudioPro<br>
Your creative journey starts here! 🚀
</p>
<p style="margin: 10px 0 0 0; font-size: 12px; color: #718096;">
© 2025 SoundStudioPro.com - Empowering creators worldwide
</p>
</div>
</div>
</div>
<script>
// Email management JavaScript
document.addEventListener('DOMContentLoaded', function() {
// Test email form handling
const testForm = document.querySelector('form[action*="test_email"]');
if (testForm) {
testForm.addEventListener('submit', function(e) {
const emailInput = this.querySelector('input[name="test_email"]');
if (!emailInput.value) {
e.preventDefault();
alert('Please enter an email address to test.');
return false;
}
});
}
// Welcome email form handling
const welcomeForm = document.querySelector('form[action*="welcome_test_email"]');
if (welcomeForm) {
welcomeForm.addEventListener('submit', function(e) {
const emailInput = this.querySelector('input[name="welcome_test_email"]');
if (!emailInput.value) {
e.preventDefault();
alert('Please enter an email address to test.');
return false;
}
});
}
});
// Template switching functionality
function showTemplate(templateType) {
// Hide all templates
const templates = document.querySelectorAll('.template-preview');
templates.forEach(template => {
template.style.display = 'none';
});
// Remove active class from all tabs
const tabs = document.querySelectorAll('.template-tab');
tabs.forEach(tab => {
tab.classList.remove('active');
tab.style.background = 'rgba(255, 255, 255, 0.1)';
tab.style.color = '#a0aec0';
});
// Show selected template
const selectedTemplate = document.getElementById(templateType + '-template');
if (selectedTemplate) {
selectedTemplate.style.display = 'block';
}
// Activate selected tab
const selectedTab = document.getElementById(templateType + '-tab');
if (selectedTab) {
selectedTab.classList.add('active');
selectedTab.style.background = '#667eea';
selectedTab.style.color = 'white';
}
}
</script>