Jump to:

22977 Posts in 11758 Topics by 2826 members

General Questions

SilverStripe Forums » General Questions » Email: From 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: 1662 Views
  • DeklinKelly
    Avatar
    Community Member
    196 Posts

    Email: From Name Link to this post

    http://doc.silverstripe.org/doku.php?id=email

    I see how to set the "from" email address but I do not see how to set the "from" name.

    How can I make an email from "Foo Bar <foobar@example.com>" ?

    $email = new Email($from, $to, $subject, $body);
    $email->sendPlain();

  • Willr
    Avatar
    Forum Moderator
    5462 Posts

    Re: Email: From Name Link to this post

    Chances are new Email(Foo Bar<foo@bar.com>, .... ) will work fine

  • timwjohn
    Avatar
    Community Member
    98 Posts

    Re: Email: From Name Link to this post

    It's not working for me. It seems somewhere along the line extra angle brackets are added.

    e.g. "Joe Bloggs <joe@bloggs.com>" is becoming "<Joe Bloggs <joe@bloggs.com>>" and the server throws the following:

    [Warning] mail() [function.mail]: SMTP server response: 501 <Joe Bloggs <joe@bloggs.com>>: "@" or "." expected after "Joe"

    Anyone else got this problem and/or a workaround?

  • jhirm
    Avatar
    Community Member
    21 Posts

    Re: Email: From Name Link to this post

    I'm having this problem too... seems uncommon, since there isn't much on the forum (or the googler) about it. I get an "Invalid email: \'From Name <fromname@fromserver.com>\'" when setting the from address like:

    $from = "From Name <fromname@fromserver.com>";

    Ideas?

  • jhirm
    Avatar
    Community Member
    21 Posts

    Re: Email: From Name Link to this post

    Just kidding! For me it was because I was using PHPMailer instead of the built-in mailer. Easily fixed.

    1662 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.