I am hoping for some direction here. I have been working on this for 2 days now. I have read everything I can in the forum, Wiki, and watched every video I could find related to forms and email. None of it is really up to date and most of what I found was for 2018.
I have tried this is both 5 latest build and 6 latest beta.
Quick overview of what I am trying to do and the config.
Created a very simple form with 2 input fields and a text area. Name, Email, Comments. Using PHP nothing else but just that form. App\Container\Row\Column\Form\Vertical Form Groups, and then a button
Form1
Method is post and set to Server Connect
Action is set to pull in API
Global Mailer has been set to SMTP and using SSL. User name and pwd verified works so know that is correct
Using the API I imported form and $post values
Set Execute to Send Mail
Set to pull from global mail config
Completed values per steps form to email in wiki
Now I have tried a lot of things and none of them send and email.
For the form currently is is set as above and I have a dynamic event on server connect sucess to submit and then clear the form
I have set the form as default at the moment. Note tired as submit as well
I have set the button now as dynamic event on mouse click to validate the 3 fields and submit and then clear
Nothing is working. Docs are not up to date for even 5
Just trying to determine what I am missing. I have made this very basic at first just to verify this works.
Using PHP with BS5 and own web
What should this config be to work. I know it’s me just missing something. I used to use PHP mail in the past but trying to move to forms.
First of all, you need your button to be a submit button, so set its type to submit. Then you should apply the validation on the inputs directly not on form dynamic events.
Okay I have set the button as submit and removed the dynamic actions. Tested it and it still does the validation just does not clear the form or send the email yet. I appreciate the responses.
This is very helpful. Three things.
One I did get a 404 error and that was due to the text field being required.
I removed that validation
Now I get the message body is empty.
Attached is what I am using.
BTW I put something in there and tested it and get SMTP error and I will continue to work that as well however; need insight to what I am missing on the text binding.
Okay this debug thing is really helpful Teodor!!!
I set it to server default and just put test in my body to see if the form works and success. Getting way closer now. I am learning so thank you for your patience.
So need to know why text binding is failing on my side. Any other helpful tips there?
Will try to figure out SMTP why it fails.
Okay I updated the text to just say comments for ID and name. I then went to my API and set mail body to:{{$_POST.comments}}
That did it for getting the contents of the text field. Now more tweaking and getting some additional things in place. Any good tips for a redirect that email was sent successful and that someone would contact them within 24 hours and where it should go?
Again thanks to Teodor. For those trying to set this up this should be the first go to as it’s a time saver.
On the form properties, use a “succesfull” dynamic event and then (when the api is succesfuly) you can redirect to another page using the browser component (previously added to the page). Or you can set it to open a modal. You can choose.
Ps you can use other events like error/unauthorized/invalid
Okay been doing some digging and nearly have SMTP all setup. Had some additional backend work to do as well.
Now with the debug mode I am now getting connectivity. However; my last part in the response is this error after the SMTP connection and looking for tips and tricks on how to address this. I am still fairly new at web dev and still learning.
The error. I get 200 post in debug and the response tab has this:
Fatal error: Uncaught ErrorException: Cannot modify header information - headers already sent by (output started at /pathtofile/dmxConnectLib/PHPMailer/PHPMailer/SMTP.php:279) in /pathtofile/dmxConnectLib/dmxConnect.php:84 Stack trace: #0 [internal function]: exception_error_handler(2, ‘Cannot modify h…’, ‘/pathto…’, 84, Array) #1 /pathtofile/dmxConnectLib/dmxConnect.php(84): header(‘HTTP/2.0 500 In…’) #2 [internal function]: exception_handler(Object(ErrorException)) #3 {main} thrown in /pathtofile/dmxConnectLib/dmxConnect.php on line 84
Fatal error: Uncaught ErrorException: Cannot modify header information - headers already sent by (output started at /pathtofile/dmxConnectLib/PHPMailer/PHPMailer/SMTP.php:279) in /pathtofile/dmxConnectLib/dmxConnect.php:45 Stack trace: #0 [internal function]: exception_error_handler(2, ‘Cannot modify h…’, ‘/pathto…’, 45, Array) #1 /pathtofile/dmxConnectLib/dmxConnect.php(45): header(‘HTTP/2.0 500 In…’) #2 [internal function]: fatal_handler() #3 {main} thrown in /pathtofile/dmxConnectLib/dmxConnect.php on line 45
Now I did change the path to just for this post. It is not the real path.
Also, I did open up the two files referenced above and looked at the line number content:
header($protocol . ’ 500 Internal Server Error’);