Thanks to visit codestin.com
Credit goes to github.com

Skip to content

access token expire after 1 hour and i can't send mail after that #13

@elgreatly

Description

@elgreatly

i used this module to send mail with gmail account and create application on google console api and create refresh token and access token. it works fine but the access token expired after 1 hour and after that i can't send another email till generate new access token and copy/paste it on my file how can i used it to work for constantly not just for 1 hour

this is my code

var xoauth2gen = xoauth2.createXOAuth2Generator({
    user: {user},
    clientId: {clientId},
    clientSecret: {clientSecret},
    refreshToken: {refreshToken},
    accessToken: {accessToken}
});

xoauth2gen.on('token', function(token){
    console.log('New token for %s: %s', token.user, token.accessToken);
});

var mailOptions = {
                    from: {mail-from},
                    to: {email-to},
                    subject: '......',
                    html: '......' 
                };

transporter.sendMail(mailOptions, function(error, info){
     if(error){
          console.log(error);
     }else{
          console.log('Message sent: ' + info.response);
     }
     transporter.close();
});

i will appreciate any help
Thanks for your effort

Metadata

Metadata

Assignees

No one assigned

    Labels

    No labels
    No labels

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions