-
Notifications
You must be signed in to change notification settings - Fork 0
Expand file tree
/
Copy pathtest-email.html
More file actions
119 lines (101 loc) · 4.41 KB
/
test-email.html
File metadata and controls
119 lines (101 loc) · 4.41 KB
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
104
105
106
107
108
109
110
111
112
113
114
115
116
117
118
119
<!DOCTYPE html>
<html lang="en">
<head>
<meta charset="UTF-8">
<meta name="viewport" content="width=device-width, initial-scale=1.0">
<title>Email Test Page</title>
<link rel="icon" type="image/png" href="FusionLab-logo.png">
<script type="text/javascript" src="https://cdn.jsdelivr.net/npm/@emailjs/browser@3/dist/email.min.js"></script>
</head>
<body>
<h1>EmailJS Test Page</h1>
<p>This page tests EmailJS functionality</p>
<button onclick="testEmailJS()">Test EmailJS</button>
<button onclick="testEmailJSInit()">Test EmailJS Init</button>
<button onclick="showAuthFix()">Show Authentication Fix</button>
<div id="status"></div>
<script>
function updateStatus(message) {
document.getElementById('status').innerHTML += '<p>' + message + '</p>';
}
function testEmailJSInit() {
updateStatus('Testing EmailJS initialization...');
if (typeof emailjs !== 'undefined') {
updateStatus('EmailJS library loaded successfully');
try {
emailjs.init("pT4qeVdM8rKuP1eA7");
updateStatus('EmailJS initialized successfully');
} catch (error) {
updateStatus('EmailJS init error: ' + error.message);
}
} else {
updateStatus('EmailJS library not loaded');
}
}
function testEmailJS() {
updateStatus('Testing EmailJS send...');
if (typeof emailjs === 'undefined') {
updateStatus('EmailJS not available');
return;
}
// Test parameters
const templateParams = {
to_email: "nathanfielder0530@gmail.com",
to_name: "Test User",
from_name: "Test Candidate",
from_email: "test@example.com",
subject: "Test Email from Skill Test Platform",
message: "This is a test email to verify EmailJS is working.",
candidate_name: "Test Candidate",
candidate_email: "test@example.com",
candidate_address: "123 Test St, Test City, Test Country",
candidate_phone: "123-456-7890",
skill_tested: "Test Skill",
score: "5/10",
percentage: "50%",
time_remaining: "01:30",
question_details: "Test question details"
};
updateStatus('Sending test email...');
emailjs.send('service_mps3bzd', 'template_c4rdgkl', templateParams)
.then(function(response) {
updateStatus('Email sent successfully! Response: ' + JSON.stringify(response));
})
.catch(function(error) {
updateStatus('Email failed! Error: ' + JSON.stringify(error));
// Check for authentication issue
if (error.status === 412 && error.text && error.text.includes('insufficient authentication scopes')) {
updateStatus('🔴 GMAIL AUTHENTICATION ISSUE DETECTED!');
updateStatus('This is a Gmail permissions problem, not a code issue.');
updateStatus('See the "Show Authentication Fix" button for solution.');
}
});
}
function showAuthFix() {
const fixSteps = `
🔴 Gmail Authentication Issue - How to Fix:
1. Go to EmailJS Dashboard: https://dashboard.emailjs.com/
2. Navigate to "Email Services"
3. Find your Gmail service (service_mps3bzd)
4. Click "Edit" or "Reconnect"
5. Re-authenticate with Gmail
6. IMPORTANT: Grant these permissions:
✅ Send emails
✅ Read emails (if prompted)
✅ Manage emails (if prompted)
Alternative Solutions:
• Use a different email service (Outlook, Yahoo)
• Create a new Gmail service with proper permissions
• Contact EmailJS support for assistance
Current Error: ${error.status} - ${error.text}
`;
alert(fixSteps);
}
// Auto-test on page load
window.onload = function() {
updateStatus('Page loaded, testing EmailJS availability...');
testEmailJSInit();
};
</script>
</body>
</html>