Contact plugin ignores environment from settings
Created 7 years ago by emergingdznsI'm getting this error in the logs:
[2017-06-02 12:26:04] local.ERROR: GuzzleHttp\Exception\ClientException: Client error: `POST https://api.sparkpost.com/api/v1/transmissions` resulted in a `400 Bad Request` response:
{ "errors": [ { "message": "Invalid domain", "description": "Unconfigured Sending Domain <localhost.com> ", "code": "700 (truncated...)
in /path/to/site/vendor/guzzlehttp/guzzle/src/Exception/RequestException.php:111
But in my .env I have MAIL_FROM set to the email address from my site, which is an authorized sender. The notifications module works without error. Any thoughts on how to fix this? Do I really have to edit my config files and hard set the from domain??
Holy WTF?!?! In the source for the contact plugin the from address is hard coded!!!
call_user_func_array(
[$this->message, 'from'],
$parser->parse(
(array)$this->builder->getOption(
'from',
$settings->get('streams::server_email', 'noreply@localhost.com')
),
$input
)
);
Why would anyone do this? Now I have to fork this damn thing to change it. Ugh.
@ryanthompson Dang you and your sexy magic! Duh. I added .from('emailaddressitshouldcomefromhere')
to the plugin twig code and now it works. Duh. Sorry.
Ya the DEFAULT setting comes from Settings -> System -> Server Email - however based on your above comments that no-reply could be within an env (should be anyways) as well as the settings default value.
Can you create an issue and reference this thread? I'll knock it out.
PS I challenge you to find a hardcoded anything in my code 😛
@ryanthompson Dang you and your sexy magic! Duh. I added
.from('emailaddressitshouldcomefromhere')
to the plugin twig code and now it works. Duh. Sorry.