If you store the password in the PHP, it will be accessible to anyone who has the PHP (i.e. anyone who has the plugin). If you store it in the database, it will be accessible to anyone who has direct access to the database (i.e. anyone who installs the plugin and knows how to use phpMyAdmin).
However, to store a simple password for a plugin, I’d use a WordPress option. This allows you to easily retrieve the password with code and makes things very flexible. It also allows you to let the user change the stored password if necessary.
// Retrieving the password
$smtp_password = get_option( 'my_smtp_password' );
// Setting the password
update_option( 'my_smtp_password', $new_smtp_password );
Just don’t use your regular email password for this. I recommend you set up a dedicated email account for your site to send messages through and keep both the name and password separate from anything you use personally.
Related Posts:
- How to bulk send emails
- Disable email notification after change of password
- wp_mail and BCC headers
- Sending all emails using SMTP
- How to get current post ID in Contact Form 7 wpcf7_before_send_mail hook action
- Send email when a new post is published [closed]
- Email Notifications of new posts to users – suggestions [closed]
- How to add usermeta to “Notice of Email Change” email message
- Notify commenters about new replies
- Is there a plugin that allows a user of your site to get an email from you with an attachment?
- Plugin for Sending Email to Readers about New Posts? (besides “Subscribe2 “)
- Server-side subscribe by email?
- WP Mail SMTP: What do the SSL/TLS options mean? [closed]
- wp_mail() is not working on server
- A very basic question – how to properly use wp_mail() in a plugin
- WordPress plugin for mail subscriptions [closed]
- Is there a plugin to record querystring parameters for a page (for customer tracking)? [closed]
- action-scheduler vs wp-background-processing
- Easy Digital Downloads (EDD) – Purchase Receipt emails couldn’t be logged
- WordPress sending emails continuously. How to stop it?
- wp_mail attachment not working
- Setting Custom Email From name and email address in wp_email()
- how to incude logo in contcat form 7 email [closed]
- Check if email address exists front end with AJAX in a plugin
- Woocommerce email template customization [closed]
- Is it possible to install two mail plugins together in a single WordPress site? How to do it? [closed]
- Sending email from inside a plugin using PHP PEAR
- Can’t send mails using contact plugin [closed]
- Hook into and send mail using WP Mail SMTP type plugin from HTML static front page?
- Email Bounce Address
- WordPress Registration Email by Role
- Get sent emails without email logs
- How to send an automated email to the customers when product is added woocommerce
- Looking for a way that will collect visitors emails before letting them view the blog posts [closed]
- Display encrypted content on my website
- Sending HTML emails via wp_mail not working properly
- Changing page URL and connect newsletter to MailChip
- Send email when a portfolio project is updated
- Notify comment author upon reply
- Sync User to cPanel webmail?
- Load Javascript from Plugin in One Page Only?
- How to pass variables to a function argument using add_action [duplicate]
- Is it possible to send blog posts via email to subscribers?
- How can i create a newsletter for my wp blog? [closed]
- Implementing an “Email this” button?
- Send admin an email when a user’s search has no results
- Looking for advice for a mail sending plugin
- How to check if an email was sent from or originated from a specific plugin?
- Plugin to email a post or page to someone
- Collecting email addresses via a “beta” sign up form
- SMTP Error: Could not authenticate [closed]
- Alternate email sending service – eg: AWS SES [closed]
- Send email with list of active plugins upon activation/deactivation
- WordPress: Add custom add_filter for custom functions
- Sending HTML email containing custom fields to site users from WordPress
- Getting 400 Error: redirect_uri_mismatch when trying to grant permission to Gmail SMTP plugin
- sending different email notification while registration based on user role
- Function added to hook “new_to_publish” not executing – custom plugin
- Generate Email Newsletter HTML from Posts published within a Date Range?
- Two WooCommerce installations on the same server, one sends customer emails but the other does not
- How to add a button to check the emails of my domain?
- Contact Form 7 Plugin emails not being received by some accounts
- Plugin to send messages to members/lists but not full-blown newsletters
- In wordpress how to sent different email separetly when i click on different email ids [closed]
- Mass Mail Plugin to Email Specified User Roles [closed]
- How can I add user profile fields to my mailpress mailout
- plugin for emails to prevent spam but also let mailto working?
- Can Postie be used to submit podcasts via email?
- WordPress latest core update conflicting with newspack-newsletter plugin
- WordPress – send digital product with custom email
- How to display emails as a post?
- how to show all posts of each category in pages
- How to create a form where you can select multiple recipients, based on a list of website users?
- SMTP emails not picking up the correct From name and From email
- Changing the Default New User Notification Email
- I want to schedule email (date, time is in database->table) wp_schedule_event() not working
- How to change a wordress plugin php code in my child’s functions.php file?
- Send email when a user registers Rest api
- WordPress eMails not working
- How to send custom mail when a user complete a specific form
- Do_shortcode before send email content
- Use WordPress Site For Email List Functionality
- admin-ajax.php returning 0
- Mailpoet Sign up on Custom registration form won’t work
- Plugin sending emails to external addresses, not internal
- Get value from an input field and pass into update_meta_data as $meta_value
- Cron job emails blank
- Form tries to download a file on submit
- How can I automatically send an email with an excel file containing submissions for a form rather than an email per submission?
- Setup SMTP setting in wordpress
- How do I replace the e-mail form to functional e-mail subscription? [closed]
- Overwrite CSS of Instaemail plugin popup
- Choose User to email when adding a new post?
- Automatically send an email to list when blog is updated
- How to work email subscribe in WordPress?
- Send Processing Order Email from custom payment plugin
- Send email notification when meet the condition
- Woocommerce Emails not being sent [closed]
- WP can’t send newsletters
- WordPress isn’t sending welcome email with the password reset