0

I am trying to send a user email after he registeres on my website

My current code looks like this

const data = {
      from: 'no-reply@test.com',
      to: req.user.email,
      subject: 'Please reset your Test Account Password',
      text:
        'This is a test email to ask you to reset your Test Account Password. Good luck :)',
    }
    const options = {
      attempts: 1000,
      backoff: { type: 'exponential', delay: 30000 },
      removeOnComplete: true,
    }
    sendMailQueue.add('resetEmail', data, options)

How do I set the attempts to INFINITE?

ggorlen
  • 44,755
  • 7
  • 76
  • 106
PirateApp
  • 5,433
  • 4
  • 57
  • 90
  • 1
    If you're trying to send an email message you can have multiple issue: - email availability (mailbox full, etc.) - spam filter - destination smtp availability So I would say that is not realistic – hpfs Jul 05 '20 at 05:01
  • @hpfs so if a user registers and for some reason your email fails 5 times then what to do? not confirm the user at all? – PirateApp Jul 05 '20 at 05:03
  • 1
    It depends on your policy. What if the user gave you a wrong email address? Or just made a typo? Or the provider of his/her email is failing? My opinion you can have two approach: 1. let the user in and show a banner that he/she is not yet verified and give change password ability. 2. ignore the probblem the user will register again – hpfs Jul 05 '20 at 05:06
  • what would be those 2 approaches if you dont mind sharing? – PirateApp Jul 05 '20 at 05:07
  • 1
    sorry just hit enter :) – hpfs Jul 05 '20 at 05:08
  • 1
    My opinion you can have two approach: 1. let the user in and show a banner that he/she is not yet verified and give change password ability. 2. ignore the probblem the user will register again – hpfs Jul 05 '20 at 09:31

1 Answers1

1

In producer, set attempts while creating new task

const taskOpts = {
    attempts: Number.MAX_SAFE_INTEGER,
}

Client.add(taskType, taskData, taskOpts)
JBB
  • 317
  • 1
  • 9