No video

How To Send Email from WordPress with SMTP (without a plugin)

  Рет қаралды 43,328

Tony Teaches Tech

Tony Teaches Tech

Күн бұрын

Learn how to send email from your WordPress website without a plugin! Rather than adding YET ANOTHER plugin like WP Mail SMTP, you can configure your email settings in WordPress directly.
Code snippets and more at tonyteaches.te...
Check out my vlog channel ‪@TonyFlorida‬
#wordpress #smtp

Пікірлер: 107
@robw1138
@robw1138 Жыл бұрын
I was working on this issue today and I thought to myself "I wonder if Tony has a video on this." Thanks for all your help man!
@TonyTeachesTech
@TonyTeachesTech Жыл бұрын
Happy to help Rob! I'm glad you found me :)
@mediabytaylor2771
@mediabytaylor2771 2 жыл бұрын
This worked like a charm! Been racking my brain for almost six hours. Thanks Tony!
@TonyTeachesTech
@TonyTeachesTech 2 жыл бұрын
Glad it helped!
@shannonandmattsopenmic3257
@shannonandmattsopenmic3257 3 жыл бұрын
Thank you, a big help, the extra info regarding security in the comments is reassuring.
@TonyTeachesTech
@TonyTeachesTech 3 жыл бұрын
You're welcome!
@frankalvarez7513
@frankalvarez7513 3 жыл бұрын
Eres un "mostro"!! Really appreciate the time you take to share your knowledge. TY amigo!
@TonyTeachesTech
@TonyTeachesTech 3 жыл бұрын
I appreciate that!
@cristianpacher
@cristianpacher 6 ай бұрын
Hello Tony, nice work, but I have a question, How can I use this if I have two different forms receiving message from two different emails?
@humaidalali4903
@humaidalali4903 3 жыл бұрын
Thank you for the tutorial. I have a question about security,, is it safe to store the password in clear text in wp-config?
@TonyTeachesTech
@TonyTeachesTech 3 жыл бұрын
A quick answer to your question is yes... this is an acceptable thing to do. By default, WordPress also stores your database credentials in plain text in wp-config.php (see wordpress.org/support/article/editing-wp-config-php/). The reason for this is because WordPress needs to be given this information to interact with your database. Same thing for email like in this video. You can obfuscate the password by encrypting it, but at some point, the password will need to be decrypted and reside in memory in plain text. At this point, if a hacker is on your server and looking at your wp-config file, you have bigger problems than your password being readable by a human. The wp-config.php files is not accessible to your website visitors. The only people who should have access to this file are the website administrators. From a security perspective, your job is to protect access to your server. To do this, strong passwords to WordPress, your database, and your sever are a good start.
@humaidalali4903
@humaidalali4903 3 жыл бұрын
@@TonyTeachesTech Thank you Tony! 🙏🏻
@AbhishekSharma-eo1xe
@AbhishekSharma-eo1xe 3 жыл бұрын
How to use mailtrap in our wordpress cms for email by contact form 7
@sureshbhatt363
@sureshbhatt363 3 жыл бұрын
Hello Tony, thanks! It worked perfectly. I don't have to use a plugin now
@TonyTeachesTech
@TonyTeachesTech 3 жыл бұрын
Great!!
@VascoDanielBaiao
@VascoDanielBaiao 10 ай бұрын
Great tutorial Tony and with all the explanations. I'm a little bit concern with the password being visible at the wp-config.php. Isn't this somehow dangerous? I also want to avoid using more plugins.
@pablopodgaiz5853
@pablopodgaiz5853 4 ай бұрын
Can you show how do you capture the input values and call the wp_mail, please
@bobulele
@bobulele 28 күн бұрын
Thank you!!!
@lifechangingwords7466
@lifechangingwords7466 Жыл бұрын
Hi Tony, nice video. except for some reason it didn't work for me. Any suggestion on why or what I can do?
@rafi_45
@rafi_45 3 жыл бұрын
long live Tony. thank you man.
@TonyTeachesTech
@TonyTeachesTech 3 жыл бұрын
You're welcome!
@phkoon
@phkoon 2 ай бұрын
Thank you very much, kind sir.
@simsworld249
@simsworld249 2 жыл бұрын
thank you for the informations , I just wanna ask you if there is a possibility to send email form a site in local
@adesojiadesesan826
@adesojiadesesan826 3 ай бұрын
Thanks so much man
@TonyTeachesTech
@TonyTeachesTech 3 ай бұрын
No problem
@MrStefanica
@MrStefanica 2 жыл бұрын
Tony is a great man ! Thanks ! :-)
@TonyTeachesTech
@TonyTeachesTech 2 жыл бұрын
No doubt!
@radomirangelov3070
@radomirangelov3070 Жыл бұрын
Can't get it work under WP 6.1.1. Any ideas?
@expertcoder3101
@expertcoder3101 3 жыл бұрын
So usefull thank you so much Tony :)
@TonyTeachesTech
@TonyTeachesTech 3 жыл бұрын
You're welcome!
@virtuallyshow6782
@virtuallyshow6782 Жыл бұрын
It is not working in my localhost in WordPress... is it possible to configure it in Localhost. Thanks
@mazwenb5783
@mazwenb5783 3 жыл бұрын
Hi, will this work with Outlook? Will you do a tutorial for Outlook too? Thanks. This video is helpful.
@TonyTeachesTech
@TonyTeachesTech 3 жыл бұрын
Do you mean for an email address like you@outlook.com?
@mazwenb5783
@mazwenb5783 3 жыл бұрын
@@TonyTeachesTech Hi, yes. That is correct. Thanks and happy new year. :)
@alfanur_rizal
@alfanur_rizal Жыл бұрын
Wooe great using phpmailer,, Thank you,,
@gashumba888
@gashumba888 2 жыл бұрын
Would this method still work in sites using Oxygen Builder since it disables the theme completely?
@shivakumarpanaganti258
@shivakumarpanaganti258 3 жыл бұрын
Thanks for this video! However, I have couple of queries. I have installed wordpress using docker on GCP (ubuntu 16.04 LTS)⁶. The mail function isn't working in the docker image and I couldn't reset my password and I'm not receiving any notification mail from wordpress. I have 2 queries now: 1. What are 'SMTP_USER', 'SMTP_PASS' variables and how 'SMTP_USER' is different from 'SMTP_FROM' variable? 2. Will this approach work for a wordpress docker image? If not, what should I change? What would 'SMTP_PORT' be for a docker image?
@TonyTeachesTech
@TonyTeachesTech 3 жыл бұрын
SMTP_USER is your gmail address in this case. You'll want this to match SMTP_FROM (although they don't have to match, but spam filters might catch your email if they don't match). This approach should work with a WordPress docker image. Does that help? LMK if you have additional questions.
@brunob1748
@brunob1748 2 жыл бұрын
Can i put it on a snippet instead of Theme php? i have code snippets installed
@RespinaCollege
@RespinaCollege 3 жыл бұрын
great tutorial..... thanks
@TonyTeachesTech
@TonyTeachesTech 3 жыл бұрын
You're welcome!
@youterisim6173
@youterisim6173 3 жыл бұрын
Thank you so much !
@TonyTeachesTech
@TonyTeachesTech 3 жыл бұрын
You're very welcome!
@fangcui655
@fangcui655 3 жыл бұрын
Hi Tony, thanks for your video, but after doing everything I still can see the 'Email Server problem shown on my website. I do not know why this happened? I need your help. Thanks.
@TonyTeachesTech
@TonyTeachesTech 3 жыл бұрын
Hmm, are you using Gmail with an app password?
@RespinaCollege
@RespinaCollege 3 жыл бұрын
which one is better ?? 1 : use plugin to set SMTP settings or 2: add code to the files manually ???
@TonyTeachesTech
@TonyTeachesTech 3 жыл бұрын
I prefer to do this manually over a plugin
@MarineHobby
@MarineHobby Жыл бұрын
Hi Tony, could you update this as in the new WP 6.1 and TwentyTwentyThree do not have a functions.php file. (P.S thanks for the 20$ for hetzner worked like a charm) .....Shaan
@rodrigoscustodio
@rodrigoscustodio 3 жыл бұрын
Thank you!
@TonyTeachesTech
@TonyTeachesTech 3 жыл бұрын
You're welcome!
@JK-pr3lu
@JK-pr3lu 3 жыл бұрын
I have a plugin which has set up the SMTP stuff and this is working for my wordpress generated emails. However, I want to code an email trigger in which sends an automatic email from the back-end. Can I use this code you are explaining to set up a SECOND SMTP connection or will it over-write what my plugin has already set up?
@TonyTeachesTech
@TonyTeachesTech 3 жыл бұрын
I'm not sure how to handle multiple connections, but I would think it's possible
@daanx6154
@daanx6154 2 жыл бұрын
Great tutorial Tony. Everything is working fine. I have copied the code, added it in the correct files and changed the details and the mail came in within seconds! Now I wanted to go a step further and create an admin page with fields where the values can be added (stored in db wp-options table). I want to load the values within the PHP Variables / Constants i.e.: define( ‘SMTP_USER’, get_option( ‘smtp_user’ ) ); But as soon as I try this, the form is not sending anymore. It gets stuck at processing (using Ninja Forms) and results in an error which is logged in the console. When I revert back to add the values manually, everything is working fine. Do you perhaps have any idea what could be going wrong here? I really hope you can help me out here. Thanks in advance.
@TonyTeachesTech
@TonyTeachesTech 2 жыл бұрын
Sorry I don't know how I can help you
@bishalbanerjee8109
@bishalbanerjee8109 3 жыл бұрын
Thanks Man !!! Really appreciate your work.. You made me, subscribe your channel.. Haha
@TonyTeachesTech
@TonyTeachesTech 3 жыл бұрын
Thanks for subscribing!
@emulatorgamer6325
@emulatorgamer6325 3 жыл бұрын
I'll be creating a custom form that sends an email upon submission. Will the SMTP settings take effect if I use the wp_mail() function?
@TonyTeachesTech
@TonyTeachesTech 3 жыл бұрын
Yep
@EpithetMusicTV
@EpithetMusicTV 3 жыл бұрын
some of the smtp plugins have logging as a feature. is there a way to set up email logging without a plugin?
@TonyTeachesTech
@TonyTeachesTech 3 жыл бұрын
Probably, but this would require a bit of work. I don't actually see the benefit of logging in this case. All email communications will be stored on your email server, so I just see the logging feature as redundant. Am I missing something here with logging?
@EpithetMusicTV
@EpithetMusicTV 3 жыл бұрын
Tony Teaches Tech yeh thought it could be complicated but thought i’d ask on the off chance it wasn’t. the purpose of logging would be to know if/when something fails. for example if for some reason the smtp server couldn’t be reached then at least you’d know.
@TonyTeachesTech
@TonyTeachesTech 3 жыл бұрын
@@EpithetMusicTV oh yes, good call. This information will always be available in the server logs in case you need to access it.
@smartnon9129
@smartnon9129 2 ай бұрын
it cant work .....this is not working on my site the setting
@mahendravarma22
@mahendravarma22 3 жыл бұрын
Hi, i have integrated this in my wordpress. but i have separate core pages with forms in my wordpress. i want to call this configured function in each form separately. please suggest me how to use it.
@TonyTeachesTech
@TonyTeachesTech 3 жыл бұрын
I'm not sure I completely understand what you're trying to do. Do you want multiple SMTP settings?
@olulovejaphet
@olulovejaphet 2 жыл бұрын
Hello Tony, Pls I don't know if you can assist me of this my challenges. My custom mails recently always remain in my outboxes, but if I tried to send mail through webmail, the emails will be sent out. I noticed this when I installed WP mail SMTP. And the config was conflicted
@TonyTeachesTech
@TonyTeachesTech 2 жыл бұрын
Sorry I don’t know
@oktaycinpolat421
@oktaycinpolat421 3 жыл бұрын
Hey I'm having trouble with the form, it won't send although it says "successfully sent". Does any additional code need to be in the form php file to reference the SMTP?
@TonyTeachesTech
@TonyTeachesTech 3 жыл бұрын
No extra code is necessary
@JuanMiguelEspinalJimenez
@JuanMiguelEspinalJimenez Жыл бұрын
Hi, It will work to send WP emails such resetting password emails?
@TonyTeachesTech
@TonyTeachesTech Жыл бұрын
Yes it should
@AgarioSplitrunner
@AgarioSplitrunner 3 жыл бұрын
I installed virtualmin (email server). What smtp should I fill in wordpress settings?
@TonyTeachesTech
@TonyTeachesTech 3 жыл бұрын
You'll need to provide the same type of information
@masterbruce7592
@masterbruce7592 3 жыл бұрын
So the SMTP-Password has to be the password from the EMAIL-Account in use?
@TonyTeachesTech
@TonyTeachesTech 3 жыл бұрын
I would recommend to use an "app password" like this kzfaq.info/get/bejne/iMiEZZuJld3Ngqs.html (just the part where we create the Google App Password for you email)
@rohansharma6136
@rohansharma6136 3 жыл бұрын
Like we use mail in php to send mail then what should I use to send mail manually through this function on a custom page inside my child theme?
@TonyTeachesTech
@TonyTeachesTech 3 жыл бұрын
Can you rephrase your question?
@rohansharma6136
@rohansharma6136 3 жыл бұрын
@@TonyTeachesTech I have set up a custom page that handles the custom registration form on the WordPress page. So I want to know how like in php as we write mail($to, $subject, $message, $headers) so with the function setup in the video what should I write instead of mail
@rohansharma6136
@rohansharma6136 3 жыл бұрын
One more question I have which I am struggling with and it's very important for me. If I am setting up my custom login in WordPress environment then how can I set the custom session variables and use it anywhere I want for example like: session_start(); $_SESSION["email"] = $email
@Daviirose3
@Daviirose3 2 жыл бұрын
will this work for outlook as well
@TonyTeachesTech
@TonyTeachesTech 2 жыл бұрын
Yes
@atefjaballah2190
@atefjaballah2190 2 жыл бұрын
GMAIL STOP the application less secure to send an email, this solution is not valid anymore, is there another way to send emails !!!
@Digital_Life96
@Digital_Life96 7 ай бұрын
From name is not working please help
@VSongu
@VSongu Жыл бұрын
What does mean send an email from a website?
@JayPancholi
@JayPancholi 3 жыл бұрын
I am working on custom email template. Can anyone tell me how to call this function? I am using multiple email addresses for different purposes.
@TonyTeachesTech
@TonyTeachesTech 3 жыл бұрын
Are you using a plugin to do this?
@darshaim
@darshaim 3 жыл бұрын
what if i dont have to leave gmail credential in config file?
@TonyTeachesTech
@TonyTeachesTech 3 жыл бұрын
You will need your gmail credentials for this to work
@mahmoudmostafa5259
@mahmoudmostafa5259 3 жыл бұрын
Thank you so much for the tutorial, but I can't send an HTML email? Is there a solution Also when I want to reset the password with this method it doesn't work
@TonyTeachesTech
@TonyTeachesTech 3 жыл бұрын
Are you using Contact Form 7? There is a check box that you can see here kzfaq.info/get/bejne/os-WY9eIl7u7pqs.html that says "Use HTML content type". I don't check it in the video, but if you check it you can send HTML emails. I'm not sure why the password reset doesn't work. Are you talking about your WordPress admin password?
@mahmoudmostafa5259
@mahmoudmostafa5259 3 жыл бұрын
Thanks, Tony for the fast reply I explained everything with screenshots here: codepen.io/mahmoud97/full/BazoMQa I really hope you can help me if possible Best regards
@TonyTeachesTech
@TonyTeachesTech 3 жыл бұрын
@@mahmoudmostafa5259 it doesn't look like the linked screenshots are working for me. I saw your writeup about not using Contact Form 7. According to the WordPress docs for wp_mail (developer.wordpress.org/reference/functions/wp_mail/), "The default content type is text/plain which does not allow using HTML. However, you can set the content type of the email by using the ‘wp_mail_content_type’ filter." Here's the WP docs for wp_mail_content_type developer.wordpress.org/reference/hooks/wp_mail_content_type/. Looks like you'll need to add something like this to your functions.php file: function wpdocs_set_html_mail_content_type() { return 'text/html'; } add_filter( 'wp_mail_content_type', 'wpdocs_set_html_mail_content_type' );
@mahmoudmostafa5259
@mahmoudmostafa5259 3 жыл бұрын
@@TonyTeachesTech yes, this worked for me, thanks a lot Tony
@TonyTeachesTech
@TonyTeachesTech 3 жыл бұрын
@@mahmoudmostafa5259 I'm happy to hear that!
@indhu.v7938
@indhu.v7938 3 жыл бұрын
Sir, how to go to the page that ur are initially in
@TonyTeachesTech
@TonyTeachesTech 3 жыл бұрын
Go to example.com/wp-admin (where example.com is your actual domain name)
@indhu.v7938
@indhu.v7938 3 жыл бұрын
@@TonyTeachesTech That link is not opening
@TonyTeachesTech
@TonyTeachesTech 3 жыл бұрын
@@indhu.v7938 Do you own the website? Are you sure it's WordPress?
@ukeditz690
@ukeditz690 3 жыл бұрын
From where to get SMTP info?
@TonyTeachesTech
@TonyTeachesTech 2 жыл бұрын
You can get that from you email provider
@jacksoncremean1664
@jacksoncremean1664 2 жыл бұрын
3:13 💀rip if anybody gains any kind of access to your wordpress server
@Ryeburnyard
@Ryeburnyard Жыл бұрын
Do you need the business plan to do this? The whole point of me watching this video was to avoid getting the business plan.
@smartnon9129
@smartnon9129 2 ай бұрын
He has good ideas but the video does not work on my 2site
@exi8965
@exi8965 2 жыл бұрын
the fucking clickbait tho Jesus
Please Help Barry Choose His Real Son
00:23
Garri Creative
Рет қаралды 22 МЛН
Harley Quinn's revenge plan!!!#Harley Quinn #joker
00:59
Harley Quinn with the Joker
Рет қаралды 25 МЛН
小丑把天使丢游泳池里#short #angel #clown
00:15
Super Beauty team
Рет қаралды 44 МЛН
Zombie Boy Saved My Life 💚
00:29
Alan Chikin Chow
Рет қаралды 10 МЛН
How to send email from WordPress to Outlook 365 (for FREE!)
16:35
Minding Your Home Business
Рет қаралды 7 М.
How to Send Email in WordPress using the Gmail SMTP Server
6:09
WPBeginner - WordPress Tutorials
Рет қаралды 204 М.
13 Things To Remove From Your Website Immediately
12:33
Orbit Media Studios
Рет қаралды 308 М.
How To Setup WordPress SMTP For Sending Emails - Must Watch For All Website Owners
13:42
WPCrafter.com WordPress For Non-Techies
Рет қаралды 120 М.
How to Create Contact form in WordPress Tamil | Learn with Azar
12:56
Learn with Azar
Рет қаралды 5 М.
How To Setup WordPress SMTP For Sending Emails - Must Watch For All Website Owners
8:38
WPCrafter.com WordPress For Non-Techies
Рет қаралды 268 М.
Please Help Barry Choose His Real Son
00:23
Garri Creative
Рет қаралды 22 МЛН