H
H
Httdientee2021-01-07 17:26:06
Laravel
Httdientee, 2021-01-07 17:26:06

Error sending laravel mail, what is the reason?

When setting the condition, it gives an error 500 server error
Error in the logs

prod.ERROR: Address in mailbox given [] does not comply with RFC 2822, 3.6.2. {"exception":"[object] (Swift_RfcComplianceException(code: 0): Address in mailbox given [] does not comply with RFC 2822, 3.6.2. at /var/www/vhosts/movewheels.com/httpdocs/external-form/vendor/swiftmailer/swiftmailer/lib/classes/Swift/Mime/Headers/MailboxHeader.php:355)

The code
public function build()
    {
        $entity = Entity::find($this->entityId);
        if(isset($_COOKIE['utm_sources']) && $_COOKIE['utm_sources'] == 'google')  {
            return $this
            ->markdown('order_mail')
            ->from(env('MAIL_FROM_ADDRESS_UTM'), env('MAIL_FROM_NAME'))
            ->subject('Order from Movewheels.com')
            ->with([
                'entity' => $entity
            ]);
        }
        else {
            return $this
                ->markdown('order_mail')
                ->from(env('MAIL_FROM_ADDRESS'), env('MAIL_FROM_NAME'))
                ->subject('Order from Movewheels.com')
                ->with([
                    'entity' => $entity
                ]);
        }
    }

Answer the question

In order to leave comments, you need to log in

2 answer(s)
G
Gleb Starkov, 2021-01-07
@Httdientee

config('mail.from.address')
etc.

E
Ernest Faizullin, 2021-01-07
@erniesto77

It looks like you don't have a valid email address. With spaces or with special characters except for the dog sign

Didn't find what you were looking for?

Ask your question

Ask a Question

731 491 924 answers to any question