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

Showcase Questions /

Feedback and questions about sites in the Community Showcase.

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

Contact Form Module

Go to End

3 Posts   2501 Views


Community Member, 8 Posts

21 July 2015 at 12:40pm


i am attempting to have the contact form module dynamically use the submitter's e-mail address in the "From" field when the e-mail is sent from the website. The code block i am including below mentions to define MAIL_FROM_ADDRESS in the mysite/_config.php file, but i am unsure how to do this. Any ideas? Thank you.

//You can define MAIL_FROM_ADDRESS in mysite/_config.php
$sender = null;
if(defined('MAIL_FROM_ADDRESS')) $sender = MAIL_FROM_ADDRESS;
$email = Email::create($sender, $emailTo, $emailSubject, $html);
if($replyTo) {


Community Member, 419 Posts

21 July 2015 at 10:24pm

Contact form module?
Could you post a link? It's not an 'official' one, and many developers approach these simple tasks in various ways.

It sounds like it's far more complex than it needs to be. Often for a simple contact form a good solution is simply UserForms module.
In any case, using a defined static constant is not what you want to be doing if you're trying to send from the submitter's supplied address.
It's simply a case of setting the from parameter in the email to the submitted form field value.

Beyond that it's eceedingly simple to create a small form to use without needing a whole module. I would suggest perhaps looking at the tutorials ( to learn more.


Community Member, 8 Posts

22 July 2015 at 6:08am


Thank you. That helped me solve the issue. I did exactly as you said and the form is working fine now ("setting the from parameter in the email to the submitted form field value"). I appreciate the help. Next time, I'll consider using the UserForms Module.

Just so you know, i was using "Silverstripe Contact Form Module", as maintained by Uncle Cheese...