Jump to:

23486 Posts in 18995 Topics by 2878 members

General Questions

SilverStripe Forums » General Questions » Config setting for outgoing email name

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

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

Page: 1
Go to End
Author Topic: 1047 Views
  • DeklinKelly
    Avatar
    Community Member
    197 Posts

    Config setting for outgoing email name Link to this post

    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"

  • Martijn
    Avatar
    Community Member
    271 Posts

    Re: Config setting for outgoing email name Link to this post

    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/

  • Willr
    Avatar
    Forum Moderator
    5508 Posts

    Re: Config setting for outgoing email name Link to this post

    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

    1047 Views
Page: 1
Go to Top

Want to know more about the company that brought you SilverStripe? Then check out SilverStripe.com

Comments on this website? Please give feedback.