Rob(AU) Posted October 3, 2019 Share Posted October 3, 2019 I have installed the module and the page appears as expected. The submit button works and redirects to the success page, or not if it detects spam. No emails are sent and I get the following errors in the log: [ERROR] Mail has not been sent to Name [ERROR] Additional mail could not be sent to Name running PW 3.0.123 on PHP 7.1.31 I have searched the forum for a solution. Can anyone suggest where else I might look to solve this? Link to comment Share on other sites More sharing options...
wbmnfktr Posted October 3, 2019 Share Posted October 3, 2019 In a local environment like Laragon you have to enable mail-catcher or an external SMTP. In case of MAMP there may be similar settings. With a local Linux environment you most likely will need sendmail, msmtp or a similar setup. When this happens on a regular hosting plan your provider might have disabled this feature. I'd recommend a look at WireMail: SMTP as it uses an external SMTP server/mail account (which you define). I'd say it's the most reliable way to send emails from within ProcessWire. But that's just my opinion. Link to comment Share on other sites More sharing options...
Rob(AU) Posted October 7, 2019 Share Posted October 7, 2019 Thanks wbmnfktr, you put me on the right track. I had WireMail: SMTP installed but not configured. I actually uninstalled the module and emails are now being sent. I am having an issue where an email is sent to my address, but not to the person using the Contact form. The following is in the contact page template: <?php $scf = $modules->get('SimpleContactForm'); $options = array( 'btnClass' => 'butn1', 'btnText' => 'Send', 'emailMessage' => 'You have successfully sent a message to Rob', 'item_label' => "", 'classes' => array( 'item' => 'input-field' ) ); echo $scf->render($options); ?> <br ><br ><br ></div> </div> <?php include('./includes/foot.inc'); ?> Any clues would be appreciated. Link to comment Share on other sites More sharing options...
wbmnfktr Posted October 7, 2019 Share Posted October 7, 2019 1 hour ago, Rob(AU) said: but not to the person using the Contact form. So you want to send a copy to the website visitor itself? Never tried it but... you can define additional recipients within the options and maybe even from within a hook. <?php $this->addHookBefore('SimpleContactForm::sendAdditionalMail', function(HookEvent $event) { $form = $event->arguments(0); $emailCopy = $form->get('scf_emailcopy'); // more logic here }); More details and another hook example at the bottom of the page: https://github.com/justb3a/processwire-simplecontactform Link to comment Share on other sites More sharing options...
Roych Posted October 17, 2019 Share Posted October 17, 2019 Hello, Im usin SCF and I'm getting a lot of spam lately, is there any captcha or something else available for this. I'm not a coder so not really sure how to solve this on my own. My code right now is: <?php $scf = $modules->get('SimpleContactForm'); $options = array( 'btnClass' => 'sc_button sc_button_style_filled sc_button_size_medium', 'btnText' => 'Pošlji', 'classes' => array( 'item' => 'sc_form_item sc_form_field label_over' ) ); echo $scf->render($options); ?> Any help is appreciated ? R Link to comment Share on other sites More sharing options...
Roych Posted October 29, 2019 Share Posted October 29, 2019 bump Link to comment Share on other sites More sharing options...
3fingers Posted October 29, 2019 Share Posted October 29, 2019 On 10/17/2019 at 7:25 PM, Roych said: Hello, Im usin SCF and I'm getting a lot of spam lately, is there any captcha or something else available for this. I'm not a coder so not really sure how to solve this on my own. My code right now is: <?php $scf = $modules->get('SimpleContactForm'); $options = array( 'btnClass' => 'sc_button sc_button_style_filled sc_button_size_medium', 'btnText' => 'Pošlji', 'classes' => array( 'item' => 'sc_form_item sc_form_field label_over' ) ); echo $scf->render($options); ?> Any help is appreciated ? R Are you using the honeypot technique as described here? Link to comment Share on other sites More sharing options...
Roych Posted October 29, 2019 Share Posted October 29, 2019 Yes I have a hidden website field. R Link to comment Share on other sites More sharing options...
BFD Calendar Posted November 3, 2019 Share Posted November 3, 2019 I'm also getting a lot of spam lately. Due to previous issues my code is a bit different, and not so clear where/how to add the honeypot field. This is the contact page template code: $scf = $modules->get('SimpleContactForm'); $options = array( 'emailMessage' => "{$input->scf_name} from {$input->scf_location} with IP {$input->scf_ip} sent this message: {$input->scf_message}", 'emailFrom' => $input->scf_email, 'emailSender' => $input->scf_email, 'emailReplyTo' => $input->scf_email, 'markup' => array( 'list' => "<div {style='width:75%;'}>{out}</div>", 'item' => "<p {attrs}>{out}</p>" ), 'classes' => array( 'form' => 'form BFD_contact', 'list' => 'list-item' ) ); echo $scf->render($options); Thanks for any help. Link to comment Share on other sites More sharing options...
Nicole Posted July 15, 2020 Share Posted July 15, 2020 Hi! I'm learning more about ProcessWire and PHP in general by practicing on the different modules. I created a test form using the SimpleContactForm module and just adding 1 text field, 1 image upload and 1 file upload field. I've alternated between just one or the other and having both uploads. Without the upload fields, the form gets handled correctly and is stored as a page, however when I add an upload field it returns the following error: Fatal error: Uncaught Error: Call to a member function path() on null in C:\xampp\htdocs\avanzademo\wire\modules\Fieldtype\FieldtypeFile.module:220 Stack trace: #0 C:\xampp\htdocs\avanzademo\wire\core\WireHooks.php(924): ProcessWire\FieldtypeFile->hookProcessInput(Object(ProcessWire\HookEvent)) #1 C:\xampp\htdocs\avanzademo\wire\core\Wire.php(450): ProcessWire\WireHooks->runHooks(Object(ProcessWire\InputfieldImage), 'processInput', Array) #2 C:\xampp\htdocs\avanzademo\wire\core\InputfieldWrapper.php(961): ProcessWire\Wire->__call('processInput', Array) #3 C:\xampp\htdocs\avanzademo\wire\modules\Inputfield\InputfieldForm.module(155): ProcessWire\InputfieldWrapper->___processInput(Object(ProcessWire\WireInputData)) #4 C:\xampp\htdocs\avanzademo\wire\core\Wire.php(383): ProcessWire\InputfieldForm->___processInput(Object(ProcessWire\WireInputData)) #5 C:\xampp\htdocs\avanzademo\wire\core\WireHooks.php(823): ProcessWire\Wire->_callMethod('___processInput', Array) #6 C:\xampp\htdocs\avanzademo\wire\core\Wire.php(450): ProcessWi in C:\xampp\htdocs\avanzademo\wire\modules\Fieldtype\FieldtypeFile.module on line 220 I've been looking into the mentioned files but can't seem to find the exact error. I also looked through a couple of the posts already discussing similar issues in the forum but I can't quite pinpoint what would be a viable solution for this. If anyone can help point me in the right direction, I'd greatly appreciate it. Link to comment Share on other sites More sharing options...
bernhard Posted July 15, 2020 Share Posted July 15, 2020 Hi @Nicole Bardales I don't have a solution for you yet, but a recommendation that might help: Install TracyDebugger and you'll get a better output of your error and also some great tools for debugging your scenario. For example you can add bd($var) calls in your code and get a nice visual dump of your variable and can then track the issue down. It is a great tool for learning PW and PHP in general because it makes a lot of things visible that are usually hidden somewhare in the memory ? Hope that helps a little ? 1 Link to comment Share on other sites More sharing options...
sjaaksken Posted August 26, 2020 Share Posted August 26, 2020 Hi, I'm having troubles hiding the scf-website, I created a form.php with the following: <?php namespace ProcessWire; ?> <div class="form__item form__item--scf-website" id="wrap_Inputfield_scf-website" id='content'> <?php echo $modules->get('SimpleContactForm')->render(); ?> </div> I can't seem to hide the scf-website field, what should I add to the CSS? Link to comment Share on other sites More sharing options...
PWaddict Posted August 26, 2020 Share Posted August 26, 2020 30 minutes ago, sjaaksken said: I can't seem to hide the scf-website field, what should I add to the CSS? Use this: #wrap_Inputfield_scf-website { display: none; } Link to comment Share on other sites More sharing options...
strandoo Posted August 26, 2020 Share Posted August 26, 2020 30 minutes ago, sjaaksken said: I can't seem to hide the scf-website field, what should I add to the CSS? First, if you want to wrap the module render code in a div, don't use that class and id (and don't use 2 ids for the same element). Once the form is rendered, you'll see that there is already a div with that class that wraps the field you wish to hide. In the CSS, just target that class: .form__item--scf-website { display: none; } Link to comment Share on other sites More sharing options...
sjaaksken Posted August 26, 2020 Share Posted August 26, 2020 Thanks, it worked! got a bit lost in the whole procedure. Link to comment Share on other sites More sharing options...
PWaddict Posted May 19, 2021 Share Posted May 19, 2021 Hi, Has anyone integrate reCAPTCHA? Link to comment Share on other sites More sharing options...
strandoo Posted May 20, 2021 Share Posted May 20, 2021 @PWaddict Yes, I've got it working. I made a simple InputField that works with FlyDev's MarkupGoogleRecaptcha module so the reCaptcha can be added to the SimpleContactForm. Then, using the info on the SFC instructions page, I added the following hood to my ready.php file. I've attached the zip file of my field type if you want to take a look. I'm no expert, but I based it on another simple module. $this->addHookBefore('SimpleContactForm::processValidation', function(HookEvent $event) { $form = $event->arguments(0); $recaptcha = $form->get('recaptcha'); if (!$this->input->post->{'g-recaptcha-response'}) { // attach an error to the field $recaptcha->error(__('You didn\'t pass the reCaptcha test.')); // it will be displayed along the field } }); FieldtypeRecaptcha.zip 1 Link to comment Share on other sites More sharing options...
PWaddict Posted May 20, 2021 Share Posted May 20, 2021 @strandoo Thank you for sharing your solution. It works perfect ? Link to comment Share on other sites More sharing options...
strandoo Posted May 20, 2021 Share Posted May 20, 2021 @PWaddict Happy to help. SimpleContactForm and FlyDev's ReCaptcha did all the real work. 1 Link to comment Share on other sites More sharing options...
Flashmaster82 Posted October 3, 2021 Share Posted October 3, 2021 I need some help.. I´m trying to get the value of an select option field to display in the mail. This is my code <?php $scf = $modules->get( 'SimpleContactForm' ); $options = array( 'offert_typeoffacility' => 'offert_typeoffacility->title', 'btnText' => 'Skicka förfrågan' ); echo $scf->render( $options ); ?> And the "offert_typeoffacility" is the select option field. But it only renderering the value ID instead of the title? I tried also the message option in the module backend. Typ av fastighet: %offert_typeoffacility% but it only rendering the same ID. Do you guys have any solution to this? Please help Link to comment Share on other sites More sharing options...
strandoo Posted October 4, 2021 Share Posted October 4, 2021 @Flashmaster82 I've just had a look at how I did this before. I used a select option field to list a booking times (10:00am, 10:30am, etc). I probably got this from someone else on these forums because my comments for the code were more detailed than I usually do! Rather than use the message in the module settings, override it and use a message.php file: $scf = $modules->get('SimpleContactForm'); include("./message.php"); $options = array( 'emailMessage' => $emailMessage, ... Note: you shouldn't need 'offert_typeoffacility' => 'offert_typeoffacility->title' in the options. In message.php, sanitise and get the field title like this: $facility = $sanitizer->int($input->post->offert_typeoffacility); // (other fields)... // To get the value of an Options Field Type, you need to // first get the id submitted // then get all the options for that field // then use the eq for that option to get the title (eq starts with 0, so subtract 1 from the id) $field = $fields->get('offert_typeoffacility'); $all_options = $field->type->getOptions($field); $theFacility = $all_options->eq($facility - 1)->title; $emailMessage = "Hello, Option: {$theFacility} ... "; I try to use Page Reference fields for SimpleContactForm selects now because it's even easier: $theFacility = $pages->get($facility)->title; Link to comment Share on other sites More sharing options...
Flashmaster82 Posted January 11, 2022 Share Posted January 11, 2022 Is it possible to duplicate/Clone the module so that you have 2 different Forms/Template/Fields/Settings/Admin? Link to comment Share on other sites More sharing options...
Java Posted February 2, 2023 Share Posted February 2, 2023 Hi, In localhost I have created a contact form using SimpleContactForm. The form has three fields: name, email and message. It works, i.e. the messages are passed locally to "Test Mail Server Tool". If I leave the field 'scf-website' empty, the message "Number of fields does not match" appears in the log file and if I fill 'scf-website' with something, the message "Honeypot field was filled" appears. In both cases - 'scf-website' empty and filled - the message is sent. The "Number of fields does not match" error is annoying, but I could ignore it. The malfunctioning spam protection makes the form unusable. What now? Link to comment Share on other sites More sharing options...
strandoo Posted February 2, 2023 Share Posted February 2, 2023 Do you have ‘scf-website’ as one of the fields in the module settings > Select Form Fields settings? If so, try removing that. Link to comment Share on other sites More sharing options...
Java Posted February 3, 2023 Share Posted February 3, 2023 17 hours ago, strandoo said: Do you have ‘scf-website’ as one of the fields in the module settings > Select Form Fields settings? If so, try removing that. No I have not. Link to comment Share on other sites More sharing options...
Recommended Posts
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 accountSign in
Already have an account? Sign in here.
Sign In Now