Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Cached SMTP credentials #2169

Closed
jlabs opened this issue Dec 2, 2024 · 8 comments
Closed

Cached SMTP credentials #2169

jlabs opened this issue Dec 2, 2024 · 8 comments

Comments

@jlabs
Copy link

jlabs commented Dec 2, 2024

Describe the bug

I've update some SMTP credentials on a site, but the forms used with Formie are still using the old credentials and I can't work out why or how.

The credentials are stored in the ENV, and I replaced the new ones where the old ones were.

Using the Craft mailer test, I can see the new credentials are used. It's just when using Formie that the old credentials are used.

This was happening before I ran all updates, and still is happening post updates. I've cleared all caches, and given the server a restart. Also ran a search on the codebase and database, both return 0 results.

Steps to reproduce

  1. Change ENV for SMTP credentials
  2. Send test email
  3. Check logs of email provider.

Form settings

  • Multi-page form: No
  • Submission Method: Mixed
  • Client-side Validation: Yes
  • Custom Form Templates: Mixed

Craft CMS version

5.5.3

Plugin version

3.0.13

Multi-site?

No response

Additional context

No response

@engram-design
Copy link
Member

Formie certainly doesn't do anything special with your mailer settings, instead just handing off to Craft's mailer to do the actual sending. I suppose maybe applying project config ./craft project-config/apply --force or running a ./craft project-config/rebuild from the server database might help? Although if it's working in the Craft testing feature, it sounds like everything is in place.

One thing to bare in mind, is Formie's emails use the queue, where Craft's tests don't. You can always go an edit a Submission in the control panel, and manually send an email notification through there - this won't use the queue. If that works, then it's something to do with accessing those .env variables within the context of the queue.

@jlabs
Copy link
Author

jlabs commented Dec 3, 2024

I thought it might be queue related (I've setup the non-Craft queue system as per the Formie docs). Meant to add that in the opening message, and I've also restarted the queue.

I'll give it a go with a previous submission

@engram-design
Copy link
Member

Ah, so you're not even using the queue for email notifications? That's indeed interesting then! Let me know how manually triggering a submission goes.

More than happy to help with debugging your environment, but would need some level of access. Happy to chat more via [email protected].

@jlabs
Copy link
Author

jlabs commented Dec 9, 2024

Sorry it's taken a while to get back.

I've just tried manually triggering the email notification and can see it used the new credentials.

Correct, not using the default queue system for email notifications. Using the guide detailed on here for handling the notifications

@engram-design
Copy link
Member

Thanks for confirming, very interesting. When you say "not using the default queue system" - what method as explained in that article are you using? A cron job, daemon, Async Queue plugin, or other?

@jlabs
Copy link
Author

jlabs commented Dec 11, 2024

Oh, sorry. Using the daemon method, which gets restarted on each deployment - so it's had several restarts since the issue first came to light.

@engram-design
Copy link
Member

Okay, great - that'd be the recommended method. I have seen something similar to this before where the .env variables have been cached in some circumstances, but usually a PHP or server reset kicks things into gear.

@jlabs
Copy link
Author

jlabs commented Dec 12, 2024

That was my next thoughts to give the server a restart. It's not a serious issue as emails are sending, but I'll schedule a restart at a good time.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

2 participants