SPForm & Editing Values

Hi all,
I’m wondering how to edit/change/extend something and hope you can help.
We’re using SPForm from @bobray to make a new(er) contact page with anti-spam options. Got that working so far and am happy with what we’ve got going.

There’s a few customisations I need to implement though.
1, Can I change the redirect page? I’ve made another one with different text in it and would prefer to use this, as the current thank you page is a ‘thank you for your order’ one
I’ve now fixed this, it was under the properties. ^

2, My CC email doesn’t come through. The contact one does. Anyone have this working or know how to do this? I.E have I missed something.

3, I have formed the style lovely on the page, but I also need to format the actual email CSS and content. CSS - I have drafted something up ready. Content: I need some additional lines and content in the actual received email.
In the email for example, I can change ‘contact’ to what we wish, but can I include say for example, the name of the person contacting us? So My Business | Enquiry - From: Bob.

Does anyone know where I can edit these settings please?

I’ve edited my post a few times, as I’ve managed to work through some of them. :slight_smile:

Thank you in advance for any help you can offer.

try using bcc instead of cc, I think that works

i don’t think there is a tpl for the output, in the SPForm snippet you can change the email subject line (in properties)

you can use a custom tpl of course

1 Like

Hi @nuan88 Thank you for taking the time to reply.

Is this on the SPform snippet?

Okay so it’s not something I can do by default? If not then I will indeed look at making a custom one and including it.
Thank you! :slight_smile:

Are you using &mailAlso=`bob@somewhere.com` for the CC?

If not, try that.

1 Like


Okay I will try that now. Thank you! :slight_smile:

Sorry, where should I add this?

No sorry, I wasn’t clear.

Go to the SPForm snippet, in the Elements section, with the templates, chunks and snippets.

Then, click on that snippet and go to properties. What BobRay has done is put most the variables into these properties, so they can be changed on the fly. Pls check the attached picture for an example of the values you can control in those properties.

Here is Bob’s page with most of your answers, for example you can make your custom css for the email with [[!SPFResponse? &spfCssPath=path_to_your_css_file]]

This form should be pretty spam proof, so you will be good to go once implemented

Sorry - where should I add this exactly please?

This what I have entered…

1 Like

Thank you. I have added the mail there but not working.
How do you bcc from there?
Also, I have managed to sort the CSS for the contact form but not sure how I edit it for the form received for the incoming emails you then get?
So is the SPFResponse what I need to edit, in order to amend the incoming mail’s CSS?
Thank you again. Much appreciated.

1 Like

Try putting it in the SPForm snippet tag.

About styling the actual email sent, there’s no easy way to do that. I’m afraid SPForm was one of the first extras I ever wrote (IIRC, in 2008, maybe my very first extra), and I never thought about that. It was intended as a quick-and-dirty spam-proof contact form that needed very little configuration and worked once it was installed.

You would have to modify the $_content variable (which holds the message the user entered) in the spformproc.inc.php file around line 601, and modify or remove line 377 of that file. Your changes would be overwritten by an upgrade of SPForm, but there isn’t one planned any time soon.


Just so I am really clear, do you mean in here or somewhere else?

Bearing in mind I am really new to this… Sorry for any silly questions. Really trying to work as best I can on my own.
Or, do you mean the actual php core file itself? spfconfig.cfg.php

Ohh okay thank you. Yes I didn’t think it would be easy as it is hardcoded - I definitely get why you did it like this. Just need to add a few more things to it.
To be honest, I will give it a good go but if it’s more hassle than what it’s worth, I will leave it as is. :smiley:

1 Like

That would work, though in that location, you’d leave out the quotes/back-ticks and your change would be overwritten by an upgrade of SPForm.

A better place would be in the SPForm snippet tag on your contact page:


Be sure to use back-ticks, not single quotes, and the properties are case-sensitive so it has to be &mailAlso.

In general, with MODX extras, any snippet property value (from the list in your image) that you want to override from its default value should be put in the snippet tag with the value in back-ticks. That way, your values will survive any upgrades to the extra.

Any properties that you want to use the default for can be left out of the snippet tag. The extra will get their values from the default properties on the tab you see when editing the snippet.

Don’t worry about asking what you think are dumb questions. We were all newbies at one time. :slight_smile:


Got you!
Okay thank you…
Will definitely have another go tomorrow (almost midnight again (GMT) here) and see what I can do.
But your post definitely makes sense & I can see what you mean.
I’ve already made a child of things. So I know I can amend things on the fly & if errors appear, either retract or scrub.
Thank you and I agree. I think back about some things and how easy it can be to look at newbs and think “Oh you haven’t a clue…” but it takes time to adjust - especially if used to a plethora of technologies.
Aside from the abrupt sink or swim I was given, I am slowly starting to enjoy this and like what it is all about. Even though it’s many years old and not a new kid on the block, so to speak.
Thank you again, will have a go in the morning. I appreciate your help!

1 Like

Yeah it always takes a bit of time. With something like Wordpress, things are easier but security is not and you don’t actually have that much control. Modx sites also can last a very long time, as you can see from your system.

I think we can break it down like this:

head info includes normal stuff but some key modx code too.

header is usually just a pic and links, there are very simple tools that give you the links. And they can be/are dynamic so, in another context, you can just throw a new resource into a folder in your tree and have the resource be included instantly, no hard coding. Unusual for a banner but consider a list of FAQ questions.

content - this is your html/css, with no adjustments. But you can still stuff into this structure, in divs, that is dynamic. Like you can place a floating ad in the middle of that html.

Lots of tools to get stuff, like a folder of images or a list of product pages. output all employee’s pictures and contact info, or anything really. These can be pretty involved.

chunks - primarily for html and a few other types of code. great for stuff you want to keep all together, whether for quick updating or so you can customize the content you give the visitor

snippets - tools to do stuff with php. Grab the list of logged in users, or grab local contents, or grab anything and manipulate and display or record things. This is the real power because you can pretty much do anything with custom snippets.

For example, someone on the old forum made a snippet years ago that, upon user registration, calculated the time of registration and saved that data to a user field (that was before Modx did it by default).

1 Like

Sorry to be a pain but I entered this on the form, using your pre-built contact form and it throws this error;
"whateverEmailAddress@gmail.com" is an invalid destination. Sorry…

Okay so now have it working but no CC email I’m afraid to say.

This doesn’t work?


I believe you can also add the mail into this list

  &recipientArray=`someEmail@somewhere.com, someotheremail@somewhere.com`

No didn’t get the email.

How would that look for the contact page please?
I think I’ve done it all right, but the emails are going through for the contact, but not the CC. It’s not life or death though so I can omit it.
And thank you again. :slight_smile:

Here is the code of the SPForm snippet that BobRay posted before. I don’t know why the mailAlso doesn’t seem to work, but you can put the extra email in the array of emails to send to, that’s &recipientArray. This array can have several emails included, so all your cc emails can go in here, all within the single ticks and separated by commas but not spaces




Hi bobray,

Do you now how can i edit this values?




thanks !

You should see them in the Tpl chunk in the SPForm category.