How To Send Mail In WordPress Without Plugin
Last Updated : Mar 11, 2024
In this article we will show you the solution of how to send mail in WordPress without plugin, instead of adding yet another plugin to your website (the most common one is being WP Mail SMTP),you may set up your email preferences right in WordPress.
You will experience less overhead as a result of installing fewer plugins, and you will have a better understanding of how WordPress email functions in practice.
You may integrate a Simple Mail Transfer Protocol, or SMTP, server into WordPress to improve its email functionality. SMTP providers abound, including WP Mail,Sendinblue,Mailgun, Sendgrid, etc.
Several website owners lament WordPress's email sending issues. Using an SMTP server will make it much easier for your WordPress emails to reach recipients' inboxes.
WordPress uses PHP mail by default to send emails. Sadly, not every WordPress hosting server is set up to use PHP mail properly.
The emails may be mistakenly labeled as spam even after they have been sent successfully. This implies that they might be erased without being noticed.
Step By Step Guide On How To Send Mail In WordPress Without Plugin :-
// SMTP email settings define( 'SMTP_username', 'youremail@gmail.com' ); // username of host like Gmail define( 'SMTP_password', 'gmail-app-password' ); // password for login into the App define( 'SMTP_server', 'smtp.gmail.com' ); // SMTP server address define( 'SMTP_FROM', 'youremail@example.com' ); // Your Business Email Address define( 'SMTP_NAME', 'SEO Neurons' ); // Business From Name define( 'SMTP_PORT', '587' ); // Server Port Number define( 'SMTP_SECURE', 'tls' ); // Encryption - ssl or tls define( 'SMTP_AUTH', true ); // Use SMTP authentication (true|false) define( 'SMTP_DEBUG', 0 ); // for debugging purposes only //For Thematic Purpose add_action( 'phpmailer_init', 'my_phpmailer_smtp' ); function my_phpmailer_smtp( $phpmailer ) { $phpmailer->isSMTP(); $phpmailer->Host = SMTP_server; $phpmailer->SMTPAuth = SMTP_AUTH; $phpmailer->Port = SMTP_PORT; $phpmailer->Username = SMTP_username; $phpmailer->Password = SMTP_password; $phpmailer->SMTPSecure = SMTP_SECURE; $phpmailer->From = SMTP_FROM; $phpmailer->FromName = SMTP_NAME; }
- By making changes to a wp-config.php and function.php files, users can manually install SMTP on WordPress using this way. This approach of configuring SMTP may be the best if you have some technical know-how.
- The file wp-config.php, which is used to configure WordPress This file is located in the WordPress website's root directory. Use a file manager,FTP server,or SSH terminal to edit this.
- Themed Function File (function.php): The WordPress website's theme contains this file.To edit this file, navigate to Appearance-Theme Editor from the WordPress dashboard.
- The wp-config.php file on your WordPress website should now include the aforementioned files. We store the SMTP server configuration data in the wp-config file out of security reasons.
- Replace the red colour values in the aforementioned files with your own.If you're unsure of how to find these SMTP server settings, read this article all the way to the end.
- file for thematic purposes (functions.php) The following lines must be added to this theme functions file. By selecting Appearance - Theme Editor from the WordPress dashboard, users may access your Theme functions file.
- The code in the file mentioned above doesn't need to be changed; simply copy it or paste it into your function.php file. the settings are saved. If you don't utilize a child theme, the modifications you make will be undone when the theme is updated.
- You can try utilizing our contact us form to send an email after making the aforementioned modifications.
Conclusion :-
The easiest way to guarantee that your Wp mails are sent is via an SMTP server.Email transmission via the internet follows a set protocol.
In order to confirm that email is being sent by a legitimate sender, SMTP servers employ adequate authentication.
Your emails will safely reach users' inboxes and deliverability will increase as a result.
I hope this article on how to send mail in wordpress without plugin helps you and the steps and method mentioned above are easy to follow and implement.