Hello, I hope you can help me. I am trying to get the magento site admin email, however the correct email address does not appear.
I'm using this code
$objectManager = \Magento\Framework\App\ObjectManager::getInstance(); $scopeConfig = $objectManager->create('\Magento\Framework\App\Config\ScopeConfigInterface'); $email = $scopeConfig->getValue('trans_email/ident_sales/name',\Magento\Store\Model\ScopeInterface::SCOPE_STORE); var_dump($email);
Result
string(5) "Sales"
The admin email is camilo.perez@xxxx.com
Hello @juancamilo1a94
Have you integrated the SMTP feature with your server? If not then please add the SMTP feature and then check the email comes or not.
If my answer is helpful full then please set the accept solution flag and kudos flag so other members can take the same reference.
$email = $this->scopeConfig->getValue('trans_email/ident_support/email',ScopeInterface::SCOPE_STORE); $name = $this->scopeConfig->getValue('trans_email/ident_support/name',ScopeInterface::SCOPE_STORE);
If you look at the html input elements in the backend config screen at system -> configuration -> store email addresses, you can see they are all named something like groups[ident_support][fields][email][value]. To get the value for any of these, just replace the ident_general in the getstoreconfig function above with ident_support or whatever is in the first square brackets.