smtp mailer config lost after restore from backup
-
SMTP Mailer quits working after I import a Wordpress site from backup. Meaning email stops working. The backups re-do all the themes, plugins, users, etc so SMTP Mailer usually gets deactivated or removed.
Before I do a site restore, I get all the SMTP Mailer settings. Except for password, I don't know how to get it or if one is even used.
I've tried putting all the settings in after installing SMTP Mailer on the restored sites. But I think it's the password that isn't working since I don't know it or how to get it.
Does anyone know how to get that default SMTP credentials password or how I can get SMTP mailer to work?
Thanks,
-
@subven That's my plan C if there isn't an easier way. Plan B is a different plugin and Mailgun. I'd prefer to use the default smtp mailer with the default account settings or figure out how to capture it's password in the future before I restore from backup.
I seem to be doing a lot of these. Where I need to import a site from somewhere from a backup with various WP backup plugins/formats and get it running. Mail is always my stopping point. So I'd like to figure out a better workflow. Easiest way to get mail out with the least amount of steps after a backup import.
-
@zappy Can you explain your workflow a bit more? Are you using Cloudron backups ? When you say import, are you importing from another cloudron using Cloudron backups or is this using some WordPress plugin?
For getting the default SMTP credentials, you can open a Web Terminal and then type
env | grep SMTP_PASSWORD
.root@66b4ff23-928c-4b9e-b56c-dd65d54d35c5:/app/code# env | grep SMTP_PASSWORD CLOUDRON_MAIL_SMTP_PASSWORD=7c201bc456e6bf200aa0b25aeabb78e16e7d2daa48af0675
The
7c201bc456e6bf200aa0b25aeabb78e16e7d2daa48af0675
above is the password. -
UPDATE: I tried removing the plugin and restarting the container. It loads SMTP Mailer and puts in settings. But still, nothing sends mail.
I also tried changing the container outbound SMTP to use mail relay with Mailgun. Restarted container. Still won't send.
I ended up deactivating SMTP Mailer, installing WP Mail SMTP, put in the same mailgun settings and it all worked.
Would still like to find a better way than just using another plugin.
-
My workflow:
- Customer wants me to host a website. Usually, it's hosted somewhere else or they have a backup file they send me.
- Create new Cloudron Wordpress site.
- Install whatever Wordpress backup/restore tool the client previously used.
- Import the backup into the new Cloudron Wordpress site.
So when that happens, it overwrites all the users, adds plugins, deactivates any plugin (like SMTP Mailer) that wasn't used by the original site, adds all the content, etc.
It's after that SMTP Mailer just won't work. I'll "activate" it after a backup import, but it won't work. Same if I delete, restart and activate it again. Same if I change outbound to use relay.
-
-
@girish AFAIK passwords in environment variables change after restart (from what I remember regarding the LAMP app) so what is the point in hardcoding them into something like a plugin? You could use the variable for SMTP_PASSWORD in your config file though.
-
@subven said in smtp mailer config lost after restore from backup:
@girish AFAIK passwords in environment variables change after restart (from what I remember regarding the LAMP app) so what is the point in hardcoding them into something like a plugin? You could use the variable for SMTP_PASSWORD in your config file though.
Assuming you mean the Cloudron part, the Cloudron environment variables are kept "constant" over the life cycle of an app. Initially, our idea was to change these periodically automatically for security but it seems people put the database values into into other apps which breaks. So, we didn't implement it.
As for putting it in the plugin, the smtp plugin we use reads the password from the database and does not use config.php - https://plugins.trac.wordpress.org/browser/smtp-mailer/trunk/main.php#L725 .