how to send mail in wordpress without plugin

hey everyone this is tony seuss’s tech i’m tony and in this video i’m going to show you

how to configure your wordpress

website to send email without a plug-in now this is slightly technical but don’t you worry i’m going to walk you through every step of the way and we’re going to start out here with a demonstration so this is the wordpress website we’re going to be working with it’s and right now i do actually have a wordpress plugin to send email it’s called wp mail smtp and i just came in here and set up a couple options i’m actually using gmail to route my emails and check my emails so if you want to learn how to do that i’ll have another video linked up at the top or in the description or at the end of this video but what i want to do here is demonstrate how this actually works so everything’s configured for that it’s working let’s send a test email in my contact form and this is the contact form 7 plugin so i’m going to send it from tony i will use my gmail tony teaches tech we’ll just say hello tony okay let’s um let’s make this window small enough so we can see the inbox and we’re gonna click here to send me your message and that should pretty much right away pop up over here and it does so that is proof that this configuration is working right but when we disable that plugin the wp mail smtp plugin which we’re going to do right now we will no longer be able to send email that’s because wordpress doesn’t know

how to or like where to what what configuration to use to send the email so

let’s just demonstrate that right now we’ll go back to the contact form and we’ll do the same thing so tony florida will send it from the same email tony teaches tech this won’t send okay so oops we got the we got the email over here from before now if we send this it’s going to give us like a false positive that the email was sent but we don’t actually see it show up and again that’s because we don’t have any configuration settings for the smtp server okay so but that’s that’s what this video is about it’s going to show you how to do that without the use of the plugin or any other plugin for that matter so let’s go ahead and do that there’s two files that we’re going to edit the wp config php file and the functions.php file so let’s start with the wp config.php file and there’s a couple different ways you can edit it probably the most easiest most easiest the easiest way is through ftp if you have some type of ftp file manager you can also ssh in i’m going to use the ftp file manager that’s built into wpx hosting which is my hosting provider and i have that open over here in this window so let’s make this window big and here it is so this is the public html directory for and in here you’ll find a wpconfig.php file and this is what we’re going to want to edit so down here right above the that’s all stop editing happy blogging we’re going to put in some we’re going to define some variables and this is where it gets slightly technical but let me just walk you through it so it makes sense so i’m going to paste these in here and this these these down here are just variables they’re just php variables which are defining my credentials for accessing my email server so um username password host from email the the name that i actually want to show up on my email like from tony florida um the port and the type of security to use it’s either like ssl or tls um and then the authorization we want that to be true that’s just like we’re requiring those credentials so for you um this information will vary hopefully you’ll have some understanding of where to get that information from but this is my information that i will be using so what i’m going to do is go ahead and save this file and that’s good now we’re going to use these variables in the functions.php file next so let’s go ahead and go out of this we’ll make that half screen again bring this one full screen and we can edit the functions.php file in our wordpress admin dashboard under appearance in theme editor now ah okay this is a little bit to explain you can okay let me just show you this is my theme it’s the generate press theme and um you can come in here and find a file in here called functions.php and for some reason i’m not seeing oh here it’s right here the second thing um you can come in here and scroll down to the bottom and add the following code that we’re going to be working with and that’s that’s it’s okay it’s not recommended because you can potentially screw some stuff up what i do recommend is to install a child theme for whatever theme you’re using and then put that information in the functions.php file so if you don’t have a child theme that’s okay you can put it in here but um i’m gonna put it in my child name because that’s better practice to do that so i’m in my child theme here and i’m in my theme functions file and what i’m going to do is use my cheat sheet over here again to get some code and i’m just going to paste that code right here at the bottom so this is actually the core of this video this is what’s actually going to send use those configuration options that we just defined to send email so without getting too technical this is just basically right now there is a function in wordpress somewhere that’s called phpmailerinit and we’re going to override that with our own custom function called myphpmail or example you can call that whatever you want and here’s the definition for that function myphp mailer example and basically all we’re doing is associating our variables right here on the right hand side that we define in our wp config file with the php mailers expected values so it’s that simple and honestly we could have and this is again bad practice but we could have just put in our host name our port our username or password directly in here but it’s better to have them separated out for security purposes in the wp config file so anyway enough talking let’s update this file and at this point we should have done everything that we need to in order to successfully send an email from that contact form again so let’s go back into our website go to the contact form we will make this uh half screen again we’ll go back to our inbox here and let’s send another email so let’s do tony florida the same email tony teaches tech and this one will work now okay so we’ll come down here click to send me your message and this time it’s actually gonna work and we’ll get that uh success message and there we go so this is the the email um from tony florida subject and this one will work now there you go so that’s it that is how um to set up gmail or something outside of gmail set up email from within wordpress without a plugin um please let me know if you have any questions in the comments below i’ll do my best to help you out and if you got any value out of this video give it a thumbs up if you want to see more from me subscribe to this channel and if you do i’ll see you in the next one [Music] you

Leave a Reply