# Form Submit Failure?

**URL:** <https://forums.realmacsoftware.com/t/form-submit-failure/47841>\
**Category:** Elements\
**Created:** [May 30, 2025, 3:53pm UTC](https://forums.realmacsoftware.com/t/form-submit-failure/47841 "2025-05-30T15:53:44Z")\
**Posts on this page:** 11\
**Page:** 1

<div class="post-metadata">

**Author:** ![logrunner](https://avatars.discourse-cdn.com/v4/letter/l/59ef9b/32.png) [@logrunner](https://forums.realmacsoftware.com/u/logrunner)\
**Post date:** [May 30, 2025, 3:53pm UTC](https://forums.realmacsoftware.com/t/form-submit-failure/47841/1 "2025-05-30T15:53:44Z")

</div>

I am testing my website using ServBay on my Mac.

I installed and activated the Mailpit service.  
The config is showing:

- SMTP Port: 1025
- Username: mailuser
- Password: 

I can open the Mailpit URL at [https://mail.servbay.host](https://mail.servbay.host)

So I have setup a form:

- Host: mail.servbay.host
- Port: 1025
- Username: mailuser
- Password: 

After I have published the website, I entered data into the form and clicked the button in the Submit Component. I then get the Error dropdown triggered.

How do I find out what is causing the error. Is there a log somewhere of why it failed? I can’t see anything in the PHP error log or Javascript console.

---

<div class="post-metadata">

**Author:** ![ben](https://dub1.discourse-cdn.com/flex005/user_avatar/forums.realmacsoftware.com/ben/32/28488_2.png) [@ben](https://forums.realmacsoftware.com/u/ben)\
**Post date:** [June 2, 2025, 6:53am UTC](https://forums.realmacsoftware.com/t/form-submit-failure/47841/2 "2025-06-02T06:53:47Z")

</div>

> [@logrunner](#):
>
> Is there a log somewhere of why it failed?

There is an internal logging system available, but I chose to not activate in the components shipped in [Elements](https://elementsapp.io/) — my plan is to allow you to turn logging on and off, I’ve just had to prioritise other things these past few weeks.

I will add “Allow logging of form components” to my list, and try and get that one in sooner rather than later.

With regards to the issue — can you check that those credentials are correct? Can you send/receive email via another means with those credentials?

---

<div class="post-metadata">

**Author:** ![logrunner](https://avatars.discourse-cdn.com/v4/letter/l/59ef9b/32.png) [@logrunner](https://forums.realmacsoftware.com/u/logrunner)\
**Post date:** [June 4, 2025, 12:25pm UTC](https://forums.realmacsoftware.com/t/form-submit-failure/47841/3 "2025-06-04T12:25:46Z")

</div>

With the help of ChatGPT I ran this python script:

```auto
import smtplib
from email.message import EmailMessage

# Mailpit SMTP config
SMTP_SERVER = 'mail.servbay.host'
SMTP_PORT = 1025
SMTP_USERNAME = 'mailuser'
SMTP_PASSWORD = 'mailuserpassword'

# Email content
msg = EmailMessage()
msg['Subject'] = '✅ Test Email from Python (TLS)'
msg['From'] = 'sender@example.local'
msg['To'] = 'recipient@example.local'
msg.set_content('This email was sent using implicit TLS on port 1025 via Mailpit.')

try:
    with smtplib.SMTP_SSL(SMTP_SERVER, SMTP_PORT) as server:
        server.login(SMTP_USERNAME, SMTP_PASSWORD)
        server.send_message(msg)
        print('✅ Email sent successfully.')
except Exception as e:
    print(f'❌ Failed to send email: {e}')

```

with this result:

```auto
✅ Email sent successfully.

```

Mailpit shows:

 ![CleanShot 2025-06-04 at 13.15.54](https://europe1.discourse-cdn.com/flex005/uploads/realmacsoftware1/original/3X/9/6/960ba45bcccbacc53e7403d018793308c8ac6ad6.png)

In [Elements](https://elementsapp.io/), my Form settings are:

 ![CleanShot 2025-06-04 at 13.17.32](https://europe1.discourse-cdn.com/flex005/uploads/realmacsoftware1/original/3X/7/e/7e422953863ef038953b7ff1c59e0ba0555d9f2d.png)

When I click on the submit, nothing happens and nothing arrives at Mailpit.  
I don’t get the Error or Success messages shown.

Not sure what to check out next. I have done all the ‘Mark Page as Changed’, closed and restarted [Elements](https://elementsapp.io/), republished and I can see the Form config.php file has been updated with the Form settings:

```auto
<?php

return [
    'component_id' => 'rwBD2AFA9F_87A3_47F3_B31E_838CD83D42B3',
    'spam' => [
        'service' => 'none',
        'recaptcha' => [
            'secret_key' => '',
            'site_key' => '',
        ],
        'turnstile' => [
            'secret_key' => '',
            'site_key' => '',
        ],
    ],
    
    'email' => [
        'host' => 'mail.servbay.host',
        'port' => '1025',
        'smtp_secure' => 'tls',
        'username' => 'mailuser',
        'password' => 'mailuserpassword',
        'subject' => 'Elements Contact Us',
        'to_name' => 'Elements Webmaster',
        'to_address' => 'info@servbay.host',
    ],
    
];

```

So unless there is something that leaps out as being wrong, I can wait until logging is introduced to help figure out why this isn’t working. 🙂

---

<div class="post-metadata">

**Author:** ![Godber](https://dub1.discourse-cdn.com/flex005/user_avatar/forums.realmacsoftware.com/godber/32/26521_2.png) [@Godber](https://forums.realmacsoftware.com/u/Godber)\
**Post date:** [June 4, 2025, 1:16pm UTC](https://forums.realmacsoftware.com/t/form-submit-failure/47841/4 "2025-06-04T13:16:05Z")

</div>

on my form the username and the to address are the same

---

<div class="post-metadata">

**Author:** ![logrunner](https://avatars.discourse-cdn.com/v4/letter/l/59ef9b/32.png) [@logrunner](https://forums.realmacsoftware.com/u/logrunner)\
**Post date:** [June 4, 2025, 1:26pm UTC](https://forums.realmacsoftware.com/t/form-submit-failure/47841/5 "2025-06-04T13:26:34Z")

</div>

Changed the username and the to address to match but still the same result. It works OK being mismatched in the Python script, so I wouldn’t think they have to match?

I am getting this in the Mailpit log:

```auto
time="2025/06/04 14:22:03" level=info msg="[db] using tenant \"SBMP_\""
time="2025/06/04 14:22:03" level=info msg="[smtpd] enabling login authentication"
time="2025/06/04 14:22:03" level=info msg="[http] starting on 0.0.0.0:18025"
time="2025/06/04 14:22:03" level=info msg="[http] accessible via http://0.0.0.0:18025/"
time="2025/06/04 14:22:03" level=info msg="[smtpd] starting on 0.0.0.0:1025 (SSL/TLS required)"
time="2025/06/04 14:23:31" level=error msg="[websocket] websocket: the client is not using the websocket protocol: 'upgrade' token not found in 'Connection' header"

```

---

<div class="post-metadata">

**Author:** ![Godber](https://dub1.discourse-cdn.com/flex005/user_avatar/forums.realmacsoftware.com/godber/32/26521_2.png) [@Godber](https://forums.realmacsoftware.com/u/Godber)\
**Post date:** [June 4, 2025, 1:43pm UTC](https://forums.realmacsoftware.com/t/form-submit-failure/47841/6 "2025-06-04T13:43:29Z")

</div>

have you tried SSL rather than TLS?

---

<div class="post-metadata">

**Author:** ![logrunner](https://avatars.discourse-cdn.com/v4/letter/l/59ef9b/32.png) [@logrunner](https://forums.realmacsoftware.com/u/logrunner)\
**Post date:** [June 4, 2025, 1:52pm UTC](https://forums.realmacsoftware.com/t/form-submit-failure/47841/7 "2025-06-04T13:52:49Z")

</div>

I have now and it is working! Thanks. 🙏

I changed the username and the to address to not match and it is still working OK.

---

<div class="post-metadata">

**Author:** ![ben](https://dub1.discourse-cdn.com/flex005/user_avatar/forums.realmacsoftware.com/ben/32/28488_2.png) [@ben](https://forums.realmacsoftware.com/u/ben)\
**Post date:** [June 4, 2025, 1:53pm UTC](https://forums.realmacsoftware.com/t/form-submit-failure/47841/8 "2025-06-04T13:53:32Z")

</div>

> [@logrunner](#):
>
> I don’t get the Error or Success messages shown.

I know there is a bug currently where the error message won’t be shown when authentication to the smtp server is rejected.

> [@logrunner](#):
>
> So unless there is something that leaps out as being wrong, I can wait until logging is introduced to help figure out why this isn’t working

I can’t see anything else that could be an issue, so unfortunately you’ll have to wait for logging to be implemented — unless you feel comfortable editing the exported site yourself?

If so, you can go in and edit the `/rw/elements/com.realmac.apipack/api/src/Classes/Email.php` and use the logging class that’s available.

In that file you can do `$this->logger->info("log me")` to log a message to the `app.log` file, which can be found at `/rw/elements/com.realmac.apipack/api/logs/app.log`

---

<div class="post-metadata">

**Author:** ![ben](https://dub1.discourse-cdn.com/flex005/user_avatar/forums.realmacsoftware.com/ben/32/28488_2.png) [@ben](https://forums.realmacsoftware.com/u/ben)\
**Post date:** [June 4, 2025, 2:22pm UTC](https://forums.realmacsoftware.com/t/form-submit-failure/47841/9 "2025-06-04T14:22:05Z")

</div>

I am wondering actually if the issue is to do with the username and the to address.

I just noticed that the `to_address` is different in [Elements](https://elementsapp.io/) to the one you have set in your python script

Python: `recipient@example.local`  
[Elements](https://elementsapp.io/): `info@servbay.local`

have you tried with the exact same settings as the python script?

---

<div class="post-metadata">

**Author:** ![Godber](https://dub1.discourse-cdn.com/flex005/user_avatar/forums.realmacsoftware.com/godber/32/26521_2.png) [@Godber](https://forums.realmacsoftware.com/u/Godber)\
**Post date:** [June 4, 2025, 2:38pm UTC](https://forums.realmacsoftware.com/t/form-submit-failure/47841/10 "2025-06-04T14:38:22Z")

</div>

I said that…hahahaha

---

<div class="post-metadata">

**Author:** ![logrunner](https://avatars.discourse-cdn.com/v4/letter/l/59ef9b/32.png) [@logrunner](https://forums.realmacsoftware.com/u/logrunner)\
**Post date:** [June 4, 2025, 3:20pm UTC](https://forums.realmacsoftware.com/t/form-submit-failure/47841/11 "2025-06-04T15:20:12Z")

</div>

See this earlier post: [Form Submit Failure? - #7 by logrunner](https://forums.realmacsoftware.com/t/form-submit-failure/47841/7)

It is working now with different **username** and **to address**.

> [@Godber](#):
>
> I said that…hahahaha

Yes, thanks but that wasn’t the issue. It was not selecting SSL.

That combined with the post from @ben “I know there is a bug currently where the error message won’t be shown when authentication to the smtp server is rejected.” was masking the issue.

So, in summary all appears to be good at the moment and if I get any further issues, I can mod the exported code to output the log. 🙂
