It is for a PDI

Did you check for Email Accounts and do a Test connection?

Also, cna you try changing the From to  something as below

<instancename>@servicenowdevelopers.com

I found the answer to my problem, I can send my emails now with:

var emailOutbound = new GlideEmailOutbound();

// Set the recipient email address
emailOutbound.addRecipient('exampleRecipient@gmail.com');

// Set the sender email address
emailOutbound.setSender('exampleSend@gmail.com');

// Set the subject of the email
emailOutbound.setSubject('Hello from ServiceNow');

// Set the body of the email
emailOutbound.setBody('This is the body of the email.');

emailOutbound.save();

View solution in original post

@Jaspal Singh Thank you anyway for trying to help 🙂

Great to know.