I was using Laravel 8.64, and my emails were working fine both on prod and dev servers. However, after upgrading to 9.0.2, I have an issue with sending emails. Of course, I followed all instructions, but still, I get errors when I try to send an email.
User is not set. {“exception”:”[object] (SymfonyComponentMailerExceptionIncompleteDsnException(code: 0): User is not set.
After some reasearch in vendor folder i found class AbstractTransportFactory
that contains getUser
method.
protected function getUser(Dsn $dsn): string { $user = $dsn->getUser(); if (null === $user) { throw new IncompleteDsnException('User is not set.'); } return $user; }
When I return '';
in this if statement, everything is working fine instead of throwing an exception. Does anyone know the solution for this and why this is happening
Advertisement
Answer
I had the same issue.
Make sure that your .env file contains: MAILGUN_DOMAIN=your.domain.com MAILGUN_SECRET=your.mailgun.secret
This would be reflected as the username/password for the DSN.
Cheers