Drupal get site wide email address?

Viewed 26605

In my module I want to get the site wide email address - the one that is set in the site information admin pages and that is used for all automatically send email messages.

How can I do this?

5 Answers

You can preprocess the variable like -

function hook_preprocess(&$variables, $hook) {

  $variables['site_email'] =  \Drupal::config('system.site')->get('mail');
  //kint( $variables['site_email']);

}

then use $variables['site_email'] anywhere to get the system wide email.

Related