cancel
Showing results for 
Search instead for 
Did you mean: 

Get admin email

Get admin email

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

4 REPLIES 4

Re: Get admin email

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.

Re: Get admin email

$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 issue solved, Click Kudos & Accept as Solution.
LitCommerce - The Most Simple & Affordable Multi-channel Selling Tool

Re: Get admin email

Re: Get admin email

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.

myfordbenefits