7

From a template or a plugin, how can I get the value of admin/Settings/System Email Address ? Thanks for your help Nicolas

13

You can get this in a template like so:

{# returns an array of your email settings #}
{% set settings = craft.systemSettings.email %}

{# returns the email address #}
{{ settings.emailAddress }}

And in a plugin you can do:

craft()->systemSettings->getSetting('email', 'emailAddress')
3

In craft 3 it appears you can access it by doing the following:

{{ craft.systemSettings.email.fromEmail }}

0
1

The craft.systemSettings variable was been deprecated as of Craft 3.1.0. Here's how to do it in Craft 3.1.0+:

{{ craft.app.projectConfig.get('email').fromEmail }}

Other email settings such as replyToEmail and fromName are also available via craft.app.projectConfig.get('email').

Alternatively, email settings can be accessed via the App helper class:

{% set appHelper = create('craft\\helpers\\App') %}
{{ appHelper.mailSettings.fromEmail }}

Or in PHP:

$fromEmail = App::mailSettings()->fromEmail;

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service, privacy policy and cookie policy

Not the answer you're looking for? Browse other questions tagged or ask your own question.