Try this code:
Pastie Databasehttps://haversineconsulting.quickbase.com/db/bgcwm2m4g?a=dr&rid=660Notes:(1) The function takes arguments
email,
subject and
message and returns a promise which resolves when the email has been sent via the native method
UserWin:
function QBU_SendEmail(email, subject, message) {...}
(2) You use the function in this fashion:
var email = "dandiebolt@gmail.com";
var subject = "Subject";
var message = "<h1>Hello ${firstName} ${lastName}</h1><p>Did you file your TPS Reports?</p>";
QBU_SendEmail(email, subject, message)
.then(function() {
//your further code here
});
(3) The native
UserWin method requires the userid (eg "51084879.bdbt") which is obtained by passing the user's email to
API_GetUserInfo.
(4) The message is passed as a very short template which can include references to tokens for the
firstName and
lastName. The message can also include HTML markup.
(5) If you intent to do bulk emails you can't just wrap a loop around this code as your browser will process the code as fast as possible and will eventually run out of sockets at which time the browser will lock up. One solution it to wrap the code in an
async function.