I have some javascript that is triggered and runs this code:
async function sendWelcomeEmail(email) {
return new Promise((resolve, reject) => {
$.ajax({
type: "POST",
url: '/Emails/welcomeEmail.php',
data: {
email: email
},
success: response => {
console.log(response);
resolve();
}
});
})
}
Which then runs the test file:
// Test the connection by sending a simple email
try {
$result = $SesClient->sendEmail([
'Source' => 'sendingEmailAddress',
'Destination' => [
'ToAddresses' => ['testEmailAddress'],
],
'Message' => [
'Subject' => [
'Data' => 'Test Email',
],
'Body' => [
'Text' => [
'Data' => 'This is a test email sent using AWS SES.',
],
],
],
]);
// If the request was successful, print the message ID
echo "Email sent! Message ID: " . $result['MessageId'] . "\n";
} catch (AwsException $e) {
// If an error occurs, print the error message
echo "Error: " . $e->getMessage() . "\n";
}
The email does send and arrives in the mailbox properly. The console on the browser will show a 500 Error at jquery-3.6.4.js:10191. The code runs perfectly fine in a local environment, but when deployed to an AWS Linux 2 server it produces the 500 Error. Any ideas/suggestions on how to solve this issue?