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.

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

Email: Reply-To

Go to End

5 Posts   3346 Views


Community Member, 197 Posts

9 July 2009 at 12:43pm

Edited: 09/07/2009 12:44pm

I see how to set the "from" email address but I do not see how to set "Reply-To"

This is done with plain PHP by sending special headers:
'Reply-To:' . "\r\n"

How can I do this in SilverStripe? My code does NOT work:

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


Forum Moderator, 5523 Posts

9 July 2009 at 6:39pm

reply to is a custom header - see

You need to call $email->addCustomHeader('Reply-To', '');


Community Member, 197 Posts

10 July 2009 at 12:07pm

Thanks, willr, but your idea does not work. I tried your exact code but the custom header is not sent with the message.

Do you have another idea, or could you point me to some documentation on SilverStripe custom email headers? Thanks!


Forum Moderator, 5523 Posts

10 July 2009 at 1:08pm

Nope no idea then sorry. API docs for our email class are - but if addCustomHeader doesn't work then I have no clue


Community Member, 10 Posts

2 August 2009 at 6:20pm

$From = "";
$member = Member::currentUser();
$To = $member->Email;
$Subject = "(sitename) activation - last step before full profile control";
$Body = "<p>$member->FirstName, please say hello to Heidi,
<br />She will guide you through the rest of the activation project.
<br />Be sure to send her some sample images of your art work as part of your activation!</p>";
$email = new Email($From, $To, $Subject,$Body,null,null,"");
$email->addCustomHeader('Reply-To', '');
//send mail

Took out site name since its still launching...

But I will be sure to add it to the showcase - its a social networking site built 100% on silverstripe! Launches August 3rd 09- wish us luck!