Sending Email with sendGrid not work after Public

I found the problem, but still with a problem that is CAN’T SEND Email to outlook.com

I found the problem: the sendGrid API Key got three months ago is too old. I change a new API Key, then the code basically worked well.

I changed the .jsw file in order to pass both sender and recipient to the function sendEmailWithSenderRecipient. Here is the code.

import {sendWithService} from ‘backend/sendGrid’;

export function sendEmailWithSenderRecipient(subject, body,sender, recipient ) {
const key =“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”;
return sendWithService(key, sender, recipient, subject, body);
}
}

I finished related change to the page code.

import {sendEmailWithSenderRecipient} from ‘backend/email1’

$w.onReady(function () {

$w(“#dataset1”).onAfterSave(sendFormData);

});

function sendFormData() {

const subject = Test;

const body = `Tutor Email: ${$w(“#input1”).value}

\rStudent Email : ${$w(“#input2”).value}

\rStudent Name: ${$w(“#input3”).value}

\rSubject: ${$w(“#input4”).value}`;

const recipient = $w(“#input1”).value;

const sender = $w(‘#input2’).value;

sendEmailWithSenderRecipient(subject, body, sender, recipient)

.then(response => console.log(response));

}

I ran the code with @gmail.com, @yahoo.com and @outlook.com. The code is working good except sending emails to outlook.com. The following is my result.

It is working as recipient is gmail.com and sender is gmail.com

It is working as recipient is yahoo.com and sender is not yahoo.com

It is not working as recipient is yahoo.com and sender is yahoo.com (maybe yahoo block that condition).

It is not working as recipient is outlook.com and sender is any.

Finally I still hope someone can tell me how to fix the problem:

can’t sending emails to outlook.com