Send Mail error from form in repeated row modal

Hi,

I have managed this on another website but on this one my form to send mail within a modal which in itself in in a repeat row is failing to send.

Looking at the page inspector I get a Failed to load resource: the server responded dmxConnect/api/nameofmyapi.php:1 with the status of 500 ()

If I click thedmxConnect/api/nameofmyapi.php:1 link I get the following:

{"code":0,"file":"/var/www/vhosts/mydomain.co.uk/httpdocs/vendor/phpmailer/phpmailer/src/PHPMailer.php","line":1315,"message":"preg_replace(): Passing null to parameter #3 ($subject) of type array|string is deprecated","trace":"#0 [internal function]: exception_error_handler()\n#1 /var/www/vhosts/mydomain.co.uk/httpdocs/vendor/phpmailer/phpmailer/src/PHPMailer.php(1315): preg_replace()\n#2 /var/www/vhosts/mydomain.co.uk/httpdocs/dmxConnectLib/modules/mail.php(82): PHPMailer\PHPMailer\PHPMailer->setFrom()\n#3 /var/www/vhosts/mydomain.co.uk/httpdocs/dmxConnectLib/lib/App.php(223): modules\mail->send()\n#4 /var/www/vhosts/mydomain.co.uk/httpdocs/dmxConnectLib/lib/App.php(195): lib\App->execSteps()\n#5 /var/www/vhosts/mydomain.co.uk/httpdocs/dmxConnectLib/lib/App.php(163): lib\App->execSteps()\n#6 /var/www/vhosts/mydomain.co.uk/httpdocs/dmxConnectLib/lib/App.php(152): lib\App->exec()\n#7 /var/www/vhosts/mydomain.co.uk/httpdocs/dmxConnectLib/lib/App.php(113): lib\App->exec()\n#8 /var/www/vhosts/mydomain.co.uk/httpdocs/dmxConnect/api/Stocklists/slquoterequest.php(7): lib\App->define()\n#9 {main}"}

Other send mail forms on the site work OK so all the appConnect Components are installed OK.

Any thoughts as to what might becausing this would be greatfully recieved
CK

Please share your send mail settings
Can you describe the "subject" field value?

This is set the same as other pages on this website which send mail OK.

I'm not sure why it's creating the error mentioned above!

Also noticed if I add setupmailer and then Send Mail as I have always done it won't work, but if I do it in reverse order I can add the elements, I wondering if this bug is causing the send mail not to work on the page and is what is generating the error on the page...

  1. could you try to set a dynamic value to the sublect?


    Click the lightening and bind a text value (no matter which one, whichever you want)
    And check if it you gte the same error

  2. On the other pages you say that it works, have you compared the setup mailer and the send email to see the differences?

Setup mailer step should not be used in the server action steps. Setup mailer should only be defined under Globals in Server Connect panel!

Screenshot 2024-06-28 at 12.29.54

1 Like

And the error means you're sending some null or empty value for the mail subject.

Did'nt know that, it used to be and I assumed it was still needed, guess some update removed that need!

Have created another test page with a basic name and email input field, along with a new API Action in case some has gone wrong with the original. The mail subject is static as per attached image, everything else is as it should be yet I still get the same error on the page!!!

Is it another - reload Wappler and start again?

Can you tell us what PHP version the server is running and which version of PHP Mailer is installed.

1 Like

PHP Version 8.2.20

Looking a php info file running on the server there is no reference to phpmailer, I will PM the url to the file.

PHPMailer fixed some deprecation warning in version 6.9.1. If you use Composer then you can simply use that to upgrade to the latest version.

If you use the bundled one then I believe it is still an old version 5.5 and I would suggest to update your project to use Composer to get the latest version.

The error suggests that some NULL value is passed somewhere where it is not allowed. Perhaps output all $_POST data in your server action to validate that they are correctly being set.

Hi Patrick

My Plesk Server has PHP Composer installed, I have added "phpmailer/phpmailer": "^6.9.1" to the require section of the composer.json file.

This has forced this domain presence to use phpmailer 6.9.1

I have created a very simple page, with form and api send and still I get the same error. I've noticed the error shows a path to a folder within the httpdocs folder called 'vendor' and inside that are two folders, composer and phpmailer. I have not added this folder, is it part of Wappler? None of my other sites have this folder either.

I have not restarted the server as it's in production

This problem is not resolved no matter what I seem to do, I have added a new mailer and a simple page with a simple form with just two inputs, fullname and emailaddress. The send mail uses a static subject field, the two inputs from the linked page form and a static recipient name and email.

I still get the above error when I inspect the page.

This domain has a vendor folder added to it which has a phpmail folder in it, I haven't added this so I'm guessing Wappler has. None of the other projects I have on the same sever have this folder!

I'm now stuck unable to add any form to mail function on this website even though the existing form to mail pages work, how is that possible if new ones fail?