Thanks for replying. The npm is gmail-send. As for the credential it’s not allowed by google to provide it.
Backend code follows:
export async function sendemfile ( pruser , prto , prsubject , prtext , ppass , pfile ) {
console . log ( “pruser==>” , pruser )
console . log ( “prto==>” , prto )
console . log ( “prsubject==>” , prsubject )
console . log ( “prtext==>” , prtext )
console . log ( “pfile==>” , pfile )
**const** send = require ( 'gmail-send' )({
user : pruser ,
to : prto ,
subject : prsubject ,
text : prtext ,
pass : ppass ,
files : pfile
});
//-------------------------------------------------------------------------------------
send
({
}, ( error , result , fullResult ) => {
//console.error(error);
//console.log(result);
**if** ( error ) {
console . error ( error );
console . log ( result );
**return** ( error )
}
})
Front-end side follows:
import { sendemfile } from ‘backend/gmailfile’
$w . onReady ( function () {})
export function button3_click ( event ) {
$w ( “#text26” ). text = “”
var tochen = “”
var ezsubject = “”
tochen = $w ( "#input1" ). value
ezsubject = ` AAAAAAAAAAAAAAAAAAA` ;
**const** recipient = "example@gmail.com"
**const** sholeach = $w ( "#text50" ). text
**let** pruser = sholeach
**let** prto = recipient
**let** prsubject = ezsubject
**let** prtext = tochen
**let** ppass = $w ( "#text64" ). text
**let** pfile = 'c:/a123.pdf'
sendemfile ( pruser , prto , prsubject , prtext , ppass , pfile )
$w ( "#text26" ). text = "המייל נשלח, מומלץ לבדוק את תקינותו "
}