Sparkpost always throwing Response code 400 (Bad Request)


I’ve followed all the steps and the Mail driver for sparkpost doesn’t seem to work.




const user = {
  name: 'Person',
  email: '',
  password:  'somepassword',
  token_confirmation: randomString({ length: 40 })

// send confirmation email
await Mail.send('emails.account_confirmation', user, (message) => {
    .from('', '')
    .subject('Account Confirmation')

The result is always:


Hey friend,
According the documentation you should use this code

await Mail .connection('sparkpost') .send('view', data, (message) => { }) and the reason is because mail use smtp as default.

Another thing is that when you tried to send an email via SparkPost it actually use an sending domain sandbox. And to fix this you have to go at your SparkPost and set it up. Follow all the step and then try again.

If you want to check whether I right or not, just download the postman project and then run transmission route and you will get this message right here


Thanks, it wasn’t the configuration as .env is already set to sparkpost. As you said I needed to use the domain setup with spark and I had a typo on the from "". It is now working.