Skip to main content

This site requires you to update your browser. Your browsing experience maybe affected by not having the most up to date version.

We've moved the forum!

Please use forum.silverstripe.org for any new questions (announcement).
The forum archive will stick around, but will be read only.

You can also use our Slack channel or StackOverflow to ask for help.
Check out our community overview for more options to contribute.

General Questions /

General questions about getting started with SilverStripe that don't fit in any of the categories above.

Moderators: martimiz, Sean, Ed, biapar, Willr, Ingo, swaiba

Config setting for outgoing email name


Go to End


3 Posts   1743 Views

Avatar
DeklinKelly

Community Member, 197 Posts

30 August 2010 at 2:03am

I understand that Email::setAdminEmail(); may be used to set the email address used for outgoing messages.

How can I change the name, not just the email address, from which email is sent?

I want one line of code which I can place in _config.php to send emails from the name "My Name"

Avatar
Martijn

Community Member, 271 Posts

30 August 2010 at 2:38am

I would use Siteconfig for that.

One way is to give SiteConfig a $has_one Member and select a Member which you want to set as default contact.

Another way is to add an Email and Name field to SiteConfig and use that as default.

See this tutorial on SSBits:

http://www.ssbits.com/2-4-working-with-siteconfig/

Avatar
Willr

Forum Moderator, 5523 Posts

30 August 2010 at 10:20am

Email::setAdminEmail() can take RFC822 formatted emails so you can pass the name and email like Email::setAdminEmail("Name <email@domain.com>"); Might need to test that first though