Jump to content

Simple Contact Form


justb3a

Recommended Posts

Never! change anything in the module code!

Just go to module settings (Admin > modules > SimpleContactForm > Edit) and add there the fields. Click submit, reload the form, you will see the new fields appended.

Please have a look at the documentation!

post-2759-0-15114000-1440412681_thumb.pn

Link to comment
Share on other sites

  • 4 weeks later...

I'm having some troubles with the form. 

I've setup everything on my localhost and every thing seems to be working fine. Then i've copied everything to my server and for some reason the form stopped working. 

When I fill in all the field i get an error: 'Please verify the data you have entered.' even though everything looks fine. The weird part is that is doesn't say anything in the Logfile. 

Do you have any idea what the problem could be?

Link to comment
Share on other sites

  • 3 weeks later...

Thankyou for building out this form. I was trying to setup the plugin, but everytime I remove a field name I get the following error: 

Error: Call to a member function save() on null (line 1098 of /home/marmil113/marshhospital.com/site/modules/simplecontactform/SimpleContactForm.module)

Any idea what I can do?

Link to comment
Share on other sites

@carlos: I guess there is something broken with your database because the fieldgroup failed to save after removing a field. Is this a production installation? If not, I would recommend to deinstall this module and check the clear data option (please do a backup before). After that have a look at your database and clear all stuff generated by this module if there’s something left. If the deinstallation with the clean option fails, you have to do this manually.

I tested it again and everything is working as expected. 

Link to comment
Share on other sites

I've been playing around with simple contact form and it works great!

I'm pretty new to all this, i'm trying to send the form using ajax ( thats so the page doesn't refresh right? ), iv'e included jquery.simplecontactform.js using 

   <script src="<?php echo $config->urls->templates?>scripts/jquery.simplecontactform.js"></script>

on my main page.

but what do i do with 

if ($('.js-simplecontactform').length) {

$.simplecontactform($('.js-simplecontactform'));
}

iv'e tried adding it to my main page using <script> and also tried <?php> neither works.

Also is there a way to style the send confirmation text?

heres some examples of what i've done so far.

http://ianjburgess.com/screenshot/Screen%20Shot%202015-10-14%20at%202.40.10%20PM.png

http://ianjburgess.com/screenshot/Screen%20Shot%202015-10-14%20at%202.40.59%20PM.png

Link to comment
Share on other sites

@Mido: Not the best but simplest solution:

  •  include jQuery
  •  include SimpleContactForm script
  •  include a general js file (main.js for example) which contains the function call you mentioned above

To style the confirmation text, modify the template, add a class and add CSS for that class.

Link to comment
Share on other sites

  • 4 weeks later...

Hey

I really like this module and got it working quite well. There's only a few issues which I've encountered. Some mails are being sent directly and other need a wait time of maybe 30 minutes to be send to the email I've set in the settings. I've excluded my IP for the spam option yet it takes a long time for some messages to get through. Any idea what triggers this?

In the /scf-messages/ I can still see all the messages right away after they have been accepted by the system.  Could it still have something to do with the spam filter?

edit: Tried another IP too, still waiting for the mail...

edit 2: Last received mail took 2h to arrive

edit 3: Now they seem to come straight away... weird...

Link to comment
Share on other sites

hi,

I'm quite sure that this behaviour is not related to this module. The spam filter only checks some stuff and if everything is fine it hands the mail over to the mail agent and saves the message. Have a look at your mail log, maybe there is a queue. If the message was saved successfully, the spam checks are passed without any problem.

Link to comment
Share on other sites

Thanks @justb3a for your module, I am finally getting to use it :)

TL;DR

Is there something I need to configure in SCF to ensure it uses the WireMailSMTP module to send mail rather than in-built/default methods in PW? Thanks for any comments.

Background

I would like to sent mail via Mandrill and so as I have in the past with the PW Forms module I have installed WiremailSMPT; I noticed you said SCF now supports WireMail. I assumed that this meant when email was sent from the SCF if WireMailSMTP was installed it would automatically go via that module (and it's settings (Mandrill in my case)), but so far I am finding emails are arriving AOK but not via the WireMailSMTP module (as Mandrill is not listed in the route).

Link to comment
Share on other sites

I began editing simple_contact_form.php and found I was getting [FAILURE] CSRF Token validation failed. I back-tracked and found that, apparently, reindenting the code of the original form file with a Sublime Text plugin caused the errors..? I tried to diff the original versus the reindented one but as far as I could see nothing was 'wrong', just differently indented.

No time now to do stuff like try an alt diff tool in case the first missed something, but I thought I'd share in case this helps anyone else.

@justb3a if a copy of the indented-and-broken code would be helpful just let me know and I'll publish it on Dropbox or similar.

Link to comment
Share on other sites

@alan: Did you check that CSRF token validation works? If you load the form (frontend) there should be a hidden input containing a generated name and value:

<input type="hidden" id="_post_token" name="TOKEN1234567891X1234567891" value="A1B2c3d4efgHIj5klLmno6pQrstUVwxy" />

As said above, the name and value are generated, make sure it's not hardcoded. Also have a look at your log file (simplecontactform-log), all errors are displayed there.

I've never used WireMailSMTP – if you've figured out how to use it, please let me know!  ;)

  • Like 1
Link to comment
Share on other sites

@all Right now all is good and I am just trying to work out how to have SCF use WireMailSMTP rather than native PW transport.

It uses it out of the box, mean: you haven't to do anything in regard of SCF. SCF uses wiremail(), - and if you have installed and setup wiremailSMTP, it is used instead of the basic wiremail, which uses the PHP mail function.

  • Like 1
Link to comment
Share on other sites

@justb3a Thanks, yes the token is there and since I undid the reindenting of code it works AOK. Also thanks I have used the log to see what was wrong (very helpful, I also spotted that my test emails had hit the IP address limit per day so I upped it for testing :)

@horst Thanks, yes I assumed that it was used. But I am pretty sure it's not being used...

History: I installed and used SCF to send email (via PW built in wiremail I assume). Then I installed WireMailSMTP and set it to use my Mandrill credentials.

But email is arriving without showing Mandrill as the sender (view email headers also shows no mention of Mandrill.com) and based on all my other uses of WiremailSMTP+Mandrill I assume (where Mandrill is listed) I assume this mean Mandrill and therefore WireMailSMTP are being bypassed (I guess?).

Env: • WireMailSMTP passes it's connectivity test. • I have debug turned on.

If there's anything I can do to help test what may be happening I'd be happy to test and report.

Thanks in advance for any suggestions.

  • Like 1
Link to comment
Share on other sites

I use it on one site with wiremailSMTP and it works. But I haven't used it together with Mandrill.

I think you use a recent or latest version of SCF? (earlier version hasn't supported wiremail())

You may check in the headers of your emails for the User-Agent, e.g. ProcessWire/WireMail or ProcessWire/WireMailSMTP or ...

  • Like 1
Link to comment
Share on other sites

@horst I checked and

  • SCF is 0.1.2 which is the latest at the moment = ✔
  • header says "...X-Mailer: ProcessWire/WireMail..." = ✖

so my setup (WireMailSMTP ver 0.1.13 on a PW 2.7.0 site and SCF) seems to be working AOK but emails are bypassing WireMailSMTP :'(

@justb3a and/or @horst : if there is anything I could do here to help fix this for me (and I assume others) then I would be happy to try stuff and report back/thanks for any suggestions you may have :)

  • Like 1
Link to comment
Share on other sites

Fixed the problem where WireMailSMTP is being bypassed in favour of WireMail...

@justb3a I would usually leave module code 100% alone, but comparing how mail is called in another site I noticed it was different, so I edited `SimpleContactForm.module` around line 478 like this: 

// Below original module code bypasses WireMailSMTP
// $wireMail = new WireMail();

// Below does not bypass WireMailSMTP
$wireMail = wireMail();

and email is then sent via WireMailSMTP. If I edit it back to the original then it bypasses WireMailSMTP and I can switch back and forth depending on how I leave the code around line 478.

If this is this something you would like me to log on git etc then please let me know as I would love to have an official (unedited) copy of your excellent module that used WireMailSMTP.

Sorry if I explained that all badly and thanks again for this module, cheers, -Alan

  • Like 3
Link to comment
Share on other sites

@alan: WOW! What a great find.  ^-^  You are right. I have checked this and yes, on the site I thought it would working together, it also bypasses SMTP as you described it.

@justb3a: please can you fix this with one of the next releases?

  • Like 1
Link to comment
Share on other sites

  • 1 month later...

new version 0.2.0 brings in some new features:


  • supports multiple instances
  • allows usage of full ProcessWire API in options
  • allows to render more than one contact form on a page
  • allows to send more than one email
  • makes validation hookable
  • read on
  • Like 4
Link to comment
Share on other sites

Create an account or sign in to comment

You need to be a member in order to leave a comment

Create an account

Sign up for a new account in our community. It's easy!

Register a new account

Sign in

Already have an account? Sign in here.

Sign In Now
×
×
  • Create New...