Jump to:

17452 Posts in 4473 Topics by 1971 members

Archive

SilverStripe Forums » Archive » Replace from address on Userdefinedform

Our old forums are still available as a read-only archive.

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

Page: 1
Go to End
Author Topic: 1728 Views
  • noizy
    Avatar
    Community Member
    25 Posts

    Replace from address on Userdefinedform Link to this post

    I've got a contact form with all the usual suspects: name, email, enquiry.

    When I send as an non-logged-in user, the 'from' address that appears in my email is the site AdminEmail I defined in my _config file...

    Email::setAdminEmail('dev@breathecommunications.com');

    But how/where do I write the code that will take the submitted email address, and use that as the from address?

    I'm just using the standard ContactForm page type - do I need to extend that with my own pagetype and add some code in there, perhaps?

  • Double-A-Ron
    Avatar
    Community Member
    604 Posts

    Re: Replace from address on Userdefinedform Link to this post

    Bump and subscribe

  • Liam
    Avatar
    Community Member
    470 Posts

    Re: Replace from address on Userdefinedform Link to this post

    I wanted to do the same thing. You can't do it with the userdefined form, you must write your own code.

    I've attached how my file turned out. Be sure to make your email template in mysite/templates/email named ContactPage_Email or whatever you want to change it to.

    The code isn't commented, so if you don't understand some things, let me know.

  • Liam
    Avatar
    Community Member
    470 Posts

    Re: Replace from address on Userdefinedform Link to this post

    Hmm didn't upload the first time.

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