I am currently converting a client booking system I created into a WordPress plugin. It uses the PHPMailer library to send emails. I am using SMTP security to send the emails and thus need the email account and password. I am currently encrypting the passwords in a database and decrypting them when I need them. Everything works fine and I have no problem doing that.

If I were to make this into a plugin that would end up in the repository is this an okay practice? Is there a more secure method? It seems WordPress would like to use their options system for most things.

Also, it seems that I would just have to hope that who is ever using this plugin that their web server has an email service running. Maybe I should allow an option for non SMTP email sending. Although this makes it way more likely it will end up in a spam folder.

The guidelines are not very clear about things like this. I have been programming for years but this is my first WordPress plugin.

Any suggestions or guidance would be much appreciated! Thank you!

  • Hello! Questions here need to be specific enough that someone can answer them in a full and factual manner so you can mark it as the correct answer, we're a Q&A site, we aren't a discussion forum. Can you adjust your question to clearly state what the question is that we'd need to answer? It seems a little vague, which would be fine for a discussion but it needs to be explicit – Tom J Nowell Jul 6 at 19:19
  • Hi, great question! Did you see this? Maybe it'll answer some questions about how to store settings wordpress.stackexchange.com/questions/229438/…. The problem with encrypting/decrypting from within your plugin is that the key to encrypt/decrypt must be stored somewhere. Either in the database, or in a file. If it's in the database, you don't gain much for obvious reasons. If it's in a file then you have to do some extra work to create a one-time key for each plugin installation. Interested to see if there's a specific WP sttrategy for this. – mozboz Jul 6 at 19:23
  • @mozboz Hello. That is kind of what I was looking for. I will try out some things today from that post. Thank you very much! – Lucas Johnson Jul 7 at 11:43

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service, privacy policy and cookie policy

Browse other questions tagged or ask your own question.