代码之家  ›  专栏  ›  技术社区  ›  Finbarr

Drupal是否获得站点范围的电子邮件地址?

  •  23
  • Finbarr  · 技术社区  · 14 年前

    我该怎么做?

    5 回复  |  直到 14 年前
        1
  •  44
  •   Kevin    14 年前
    $site_email = variable_get('site_mail', '');
    
        2
  •  17
  •   baikho Chandz    9 年前

    在Drupal 8中:

    $site_mail = \Drupal::config('system.site')->get('mail');
    
        3
  •  16
  •   scw DrColossos    13 年前

    调查 system module

    variable_get('site_mail', ini_get('sendmail_from'));
    
        4
  •  2
  •   Nick Andriopoulos    12 年前

    你可以从中得到更多的想法 this link

    variable_get('site_mail', ini_get('sendmail_from'));
    
        5
  •  0
  •   Wasim Khan    5 年前

    你可以像这样预处理变量-

    function hook_preprocess(&$variables, $hook) {
    
      $variables['site_email'] =  \Drupal::config('system.site')->get('mail');
      //kint( $variables['site_email']);
    
    }
    

    然后使用 $variables['site_email'] 任何地方都可以获得系统范围内的电子邮件。