How to attach file to gmail-send

I’m able to send emails using gmail npm. I’m not able to attach a file. There is a parameter “file:” in the documentaion, but I got an error that the directory or the fle can’t be found.
I assume it can’t open a file on the local computer. If that’s the case, where the file should be located? If I save the file in a Wix collection, can it help? If yes, should I use the URL in the file parameter?

Hello. To help you better can you add a little more information.

What is the specific NPM package? I just searched for gmail through the editor-NPM package search and it says it’s not supported so I’m not sure which package you are using.

Also if you don’t mind posting the code snippet where you are attempting, that always helps as well. Just make sure not to include any tokens or anything private to your accounts.

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  =  "המייל נשלח, מומלץ לבדוק את תקינותו  " 

}