I am repeatedly getting an error in my logs stating basically that my "TO" address is not being attached to the email, and thus being rejected by Swiftmailer.
The exact error states:
production.ERROR: ***Swift_RfcComplianceException*** [0] : /home/user/laravel-site/vendor/swiftmailer/swiftmailer/lib/classes/Swift/Mime/Headers/MailboxHeader.php [Line 345] => Address in mailbox given [] does not comply with RFC 2822, 3.6.2.
It seems like the address is not being appropriately attached to the emails. I have double-checked the config/mail.php file to see if the address is configured appropriately there. It seems like it is (in that file at least), and it pulls correctly the email and name from the .env file. I went as far as to hardcode the data (instead of pulling from the .env file and it still didn't work.
Does anyone have any idea how to fix this error? The error basically says I do not have any email to send the email from, but there is an email there. Where else do i look to solve this and/or what is causing it in the first place?
If you uncomment this line the values being used will get logged to storage/logs/laravel-info.log
https://github.com/invoiceninja/invoiceninja/blob/master/app/Ninja/Mailers/Mailer.php#L46
What version of PHP are you using?
Are you using mod_php?
I've read about issues with PCRE libs which can cause this error to pop up:
https://github.com/swiftmailer/swiftmailer/issues/382#issuecomment-112405491
I am using:
I also ran the info log to see what info has been received. This is the output in the log:
production.INFO: [email protected] | [email protected] | [] []
I changed the actual email addresses. But the first email address is correctly the customer's email (intended recipient), and the second email is the logged in user's email (my work email in this case).
The rest is just the square brackets, this is the problem as those should be email address and name of where the email is being sent from ([email protected]).
So now the question is why is the company email not filling.
It looks like that is pulling from a constant CONTACT_EMAIL - now i need to find where the constant is set.
We can close this. The reason for the problem turned out that for some reason constants where not getting written to. I found the constants file and tested logged various other constants. For some reason constants were mostly null even when they were supposed to pull from the .env file. Weird issue. I think it had to do with me messing around with composer earlier and messing something up.
I just kept the database and did a fresh deploy of the code back from the original github repo and it solved the issue. This was an issue specific to me and not in general to the project.
Thank you for the help though.