-
Notifications
You must be signed in to change notification settings - Fork 0
Expand file tree
/
Copy pathtest-contact-form.js
More file actions
52 lines (44 loc) Β· 1.54 KB
/
test-contact-form.js
File metadata and controls
52 lines (44 loc) Β· 1.54 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
#!/usr/bin/env node
/**
* Test script for the contact form API
* This sends a test submission to verify SES email integration
*/
const testData = {
fullName: "Test User",
email: "test@example.com",
company: "Test Company Inc.",
budget: "50-100k",
message: "This is a test submission from the contact form to verify AWS SES integration is working correctly."
};
async function testContactForm() {
console.log('π§ͺ Testing Contact Form API...\n');
console.log('π Test Data:');
console.log(JSON.stringify(testData, null, 2));
console.log('\nπ€ Sending request to http://localhost:3000/api/contact...\n');
try {
const response = await fetch('http://localhost:3000/api/contact', {
method: 'POST',
headers: {
'Content-Type': 'application/json',
},
body: JSON.stringify(testData),
});
const result = await response.json();
console.log('π Response Status:', response.status);
console.log('π Response Body:');
console.log(JSON.stringify(result, null, 2));
console.log('');
if (response.ok) {
console.log('β
SUCCESS! Email sent successfully.');
console.log('π§ Check teamconnoisseurww@gmail.com for the test email.');
} else {
console.log('β FAILED! Error sending email.');
console.log('π‘ Check the server logs for more details.');
}
} catch (error) {
console.error('β ERROR:', error.message);
console.log('\nπ‘ Make sure the development server is running:');
console.log(' npm run dev');
}
}
testContactForm();