If you get hundreds of test email in your inbox, don't get disturbed! Be happy to know that hundreds of people implemented what they learned here... :) As always, Corey, you are one of the best in teaching python. Thanks for this contribution.
@cicerosilva-ye8mn5 жыл бұрын
hey man Where am I wrong ?? my code = = = import os import smtplib from email.message import EmailMessage EMAIL_ADDRESS = os.environ.get('EMAIL_USER') EMAIL_PASSWORD = os.environ.get('EMAIL_PASS') msg = EmailMessage() msg['subject'] = 'teste de email' msg['from'] = 'anymail@gmail.com' msg['to'] = 'anymail@gmail.com' msg.set_content('teste de emial enviado pelo script em python') with smtplib.SMTP_SSL('smtp.gmail.com', 465) as smtp: smtp.login(EMAIL_ADDRESS,EMAIL_PASSWORD) smtp.send_message(msg)
@motherfuqjohnson54605 жыл бұрын
@@cicerosilva-ye8mn what error? and what line is the error on?
@cicerosilva-ye8mn5 жыл бұрын
@@motherfuqjohnson5460 in the sccrip ModuleNotFoundError: No module named 'email.message'; 'email' is not a package
@cicerosilva-ye8mn5 жыл бұрын
at this from email.message import EmailMessage
@motherfuqjohnson54605 жыл бұрын
@@cicerosilva-ye8mn what IDE are you using? im using pycharm and i had to go into the interpreter settings to add the module. search up "how to add module to pycharm"
@sageedwards78664 жыл бұрын
For anyone that had trouble, I changed my port number from 587 to 25 and it fixed the 'gaierror' for me. Also huge thanks to you Corey!! Awesome, streamlined content.
@al-taie4 жыл бұрын
You can use (quick-mailer) module, to send email in two lines of code, with a lot of options. check out here: al-taie.github.io/quick-mailer
@carlwcampbell5 жыл бұрын
Thank you, for putting out a video of something so useful that many Pythonistas ask.
@av47875 жыл бұрын
Pythonistas
@johnweller54914 жыл бұрын
Your videos are my lifeline!! I am a retired programmer trying to learn Python. I've not used any other language apart from FoxPro since using Pascal 30 years ago.
@i5artube5 жыл бұрын
I can watch your videos on a tablet without getting blind... I'm going to thumbs up all your videos!
@Kiranhuded233 жыл бұрын
All your videos are "GOLD MINE" on the internet. I've learnt better with your videos than most others i've tried, I feel i owe you a lot , I'm making patreon contribution now!! Thanks a lott !!! god bless you Corey!!
@asega273 жыл бұрын
If this worked for you can you help me I hate to bother you
@aakashjana62254 жыл бұрын
I implemented it my flask back-end for sending automated mails to those who subscribe 😎. Thanks a lot Corey for this fantastic video.
@venkataramanansundaresan3213 жыл бұрын
can you send the code for it i am also trying to do the same but dont know how to do
@aakashjana62253 жыл бұрын
@@venkataramanansundaresan321 yes but where? Where exactly are stuck? You gotta create a mailing function where you pass in the mail address and it sends a mail everytime someone hits subscribe button on the website with their mail ID filled in from the input box
@anglerfish613 жыл бұрын
What I like about this is, eventhough the code is solid it didnt work untill I understood what I was doing. Thanks for that. That is a valuable lesson
@deliciafernandes99463 жыл бұрын
Only youtuber I can trust with python content!
@aniketbhosale74184 жыл бұрын
The Tutorial was very useful , it taught lot of stuff ,great work👍🏻 If anyone is getting Error for Environment Variable then just try by installing:- pip3 install python-dotenv then create '.env' file as it is mention your variable in that eg:- EMAIL_USER=abc@gmail.com EMAIL_PASS=abc@123 and python path lib USER=os.getenv('EMAIL_USER') PASS=os.getenv('EMAIL_PASS') just like that it's Done check by using print(USER,"",PASS).🤘🏻
@officesuperhero96115 жыл бұрын
As always, another great video chuck full of practical tips. I have never seen a video that you made that I felt was useless or poorly made. Your videos are always top notch and the best.
@mijimelon3 жыл бұрын
thank you. you explained everything perfectly line by line and argument by argument
@treaper5 жыл бұрын
Oh man this video probably saved me hours of unnecessary struggle. If you could somehow get a link to this video as one of the top answers to google queries like "Python send email with attachment pdf" I bet you would get some extra traffic! Thank you so much for your work! I know that my learning process will be much smoother when I find one of your videos on the topic I want to learn. Youda best
@ScottMorgan883 жыл бұрын
Thanks, Corey. That worked great. Note that now you need to set up a App Password if you're using a Google account. This is to get around the 2-step verification process.
@لنتسقطامةرسولهامحمدوصاحبهعمرال4 жыл бұрын
you are genius..........thank a lot of about what you doing with your lightfully teaching..... you are one of the best teacher in this world...god bless you and your family too....................you are a light for our brains
@al-taie4 жыл бұрын
You can use (quick-mailer) module, to send email in two lines of code, with a lot of options. check out here: al-taie.github.io/quick-mailer
@jodi80762 жыл бұрын
This tutorial was so simple and straightforward. Super helpful. AND it worked!! Thanks, will be sure to check out your other videos.
@nikolaosboutsioukis39452 жыл бұрын
Bro this feature was turned off by google couple of months ago how you say that it worked?
@harsh33055 жыл бұрын
Thanks a lot helped me generate automatic email notifications in my web scraping project !! PS- Puppy is so cute :D
@swarnveersingh51134 жыл бұрын
This is excellent tutorial, but you can please tell what should be used for maintype and subtype for other kinds of attachment such as csv, excel etc. And how this process stated in video is different from MIME which is present all over internet for sending attachment ? I am quite confused regarding MIME
@rotrose75313 жыл бұрын
Your python tutorials are unfailingly amazing!
@lukerobertson10004 жыл бұрын
Thanks so much Corey! It's such a nice feeling to get all the code working and follow along. I really appreciate the list of contacts idea at the end, it seems so logical to do it that way and what can I say, I'm a big fan of logic! :) Thanks again! I'm loving your content and explanations.
@al-taie4 жыл бұрын
You can use (quick-mailer) module, to send email in two lines of code, with a lot of options. al-taie.github.io/quick-mailer
@marvinreyes74594 жыл бұрын
We need more people like you man!.
@a_maxed_out_handle_of_30_chars3 жыл бұрын
your channel is a gem mine :)
@shubhamhire9390 Жыл бұрын
This was such an amazing video, it took me a lot of time to pause and then understand and then apply it to the code, but it just made me learn so much , you are such an amazing teacher sir, thanks for sharing your knowledge with us.🙏🙏🙏
@ashishpatil34165 жыл бұрын
Hey Corey, you are real tech nerd. Video is awesome.
@alexthewebdesigner18562 жыл бұрын
@Corey Schafer Thanx for posting such a comprehensive vid. None of the other videos on email via Python touched on Google settings regarding 2-step or TLS.
@potschochterpotschochter24033 жыл бұрын
I just bumped into your video. It is amazing. Thank you so much. I am so very new to Python and I think that this is one of the best tutorial I ahbe ever seen here on youtube. Thank you so much.
@darkbanditEX2 жыл бұрын
Thank you Corey for another great video. Hope to see you back again in the future.
@rahesc4 жыл бұрын
this is really awesome and helpful. you simplify it so much. thank you!!
@JorgeEscobarMX2 жыл бұрын
I loved this one, it seems so simple to send emails here.
@gameration64503 жыл бұрын
Protect Coray at all cost, he is a legend
@TeckTales6 ай бұрын
looks like they removed smtpd in python 3.12, couldn't test on localhost. Great video. God bless..
@silverzero95245 жыл бұрын
Corey can you do videos about problem solving? Data structures and algorithms and when to use them Didn't watch the video yet but I know it would be good xD
@elokachima78935 жыл бұрын
I agree with this post. Data structures and algorithms would be a very good fundamental for a developer(beginner or intermediate).
@bazareta69365 жыл бұрын
Time complexity problems
@opst17045 жыл бұрын
Yes! You are great teacher, we would love to see your DSA lessons!
@gannadheesh80436 ай бұрын
Since smtpd has been removed in Python 3.10 and later versions, you cannot use the smtpd module directly with Python 3.12. Instead, you should use the aiosmtpd package, which provides similar functionality and is compatible with modern Python versions.
@johangodinho4 жыл бұрын
Thanks a lot mate, I appreciate the effort you have put into making this video so easy to understand while also meeting the target of the intended title of the video. After looking online for a long time I finally came across your tutorial and I'm leaving with more information than I needed which is all so useful. So once again thanks a lot cus you made my day and all the best for the growth of your channel :))))
@alexvallex54873 жыл бұрын
do you know where in the code should i put by enviroment variable of the app password i
@2012daffyduck4 жыл бұрын
You are a Python God.
@al-taie4 жыл бұрын
You can use (quick-mailer) module, to send email in two lines of code, with a lot of options. check out here: al-taie.github.io/quick-mailer
@chippandenga67224 жыл бұрын
Thank you very much Corey. What could be the reason for someone to dislike such a valuable video?😂
@ivari12 жыл бұрын
How to I add a variable in the html code for the gmail?
@louiswallice37463 жыл бұрын
like many of your videos, you got the best content and also every methods works :) thanks a lot mate!
@balasankarnagarajan92385 жыл бұрын
Nice Video! KIndly make a video on "Sending Whatsapp messages" using Python
@KASANITEJ5 жыл бұрын
lol.. then its a disaster
@rewadia1233 жыл бұрын
Thanks for explaining each type in detail
@lydiaaidyl33284 жыл бұрын
Thanks a lot, especially for the HTML part, it was the only thing it worked for me after trying a lot of different options
@al-taie4 жыл бұрын
You can use (quick-mailer) module, to send email in two lines of code, with a lot of options. check out here: al-taie.github.io/quick-mailer
@scifregizmoguy5 жыл бұрын
*Question on HTML email:* *[SOVED]* Is there a way to send a HTML email without having to write it manually in triple quote, but more automated? Like if I had a file called "email.html", and I didn't want to send it as an attachment, but the email itself. Thanks, anyone. EDIT: I found a solution! If anyone is interested here it is; ### with open('my_HTML_file.html', 'rb') as f: file_data = f.read() file_type = imghdr.what(f.name) file_name = f.name #print(file_data) file_string = file_data.decode(encoding='UTF-8') #print(" ::: The file decoded into a string ::: ", file_string) msg.add_alternative(file_string, subtype='html') ###
@diplomat18374 жыл бұрын
Where does this code comes in the code. I’ve been having alternative error when I tried sending the HTML link on the code. Please some help to get me through
@ajith_e4 жыл бұрын
Hey, Thanks man !! I was just searching for the same. I have an external html file read into the script. That was semantic
@nemplayer17762 ай бұрын
Old comment, but for anyone new: instead of opening it with read bytefile (aka 'rb'), you can just read it normally as an html file (it's human readable anyways) (with just 'r' in the with statement) and put the file_data in your case as the content in msg.add_alternative. I haven't tried this, but I don't see why it wouldn't work. So: with open('my_HTML_file.html', 'r') as f: file_message = f.read() msg.add_alternative(file_message, subtype='html')
@ashu600714 жыл бұрын
this was so amazing!!! loved all your videos. big fan
@al-taie4 жыл бұрын
You can use (quick-mailer) module, to send email in two lines of code, with a lot of options check out here: al-taie.github.io/quick-mailer
@kayderl4 жыл бұрын
Thumbs up. Love all your vids, they are always so informative and useful.
@Canda-fh4xc5 жыл бұрын
Thank you Corey for the video. It will be really nice if you can make a video about how to read emails from Gmail
@Xatex182 жыл бұрын
Thank you, this clarified some questions.
@martind543 жыл бұрын
Got a new subscriber because of the content of this video!
@rushibhagwat41083 жыл бұрын
Thanks buddy you saved my project, I really appreciate your work.
@linuks87Ай бұрын
Perfect tutorial. Thanks a lot!
@novianindy8872 жыл бұрын
Beside the gmail thing, do all the scripts still work nowadays -if we use an Smtp server?
@shazkingdom17025 жыл бұрын
Bronx puppy 🐶 is cute 😂
@a.wessel88652 жыл бұрын
Great video, Corey! I am a total newbie to Python, and you made this so easy to follow. Could you possibly create a video or point me towards a resource where a Python script is used to send an HTML email with variable data from a SQL query? For example, if I wanted to email a simple summary report with the sum of deposit balances, deposit counts, loan balances, and loan counts with HTML formatting, could this be done with a Python script?
@debjitchattopadhyay76274 жыл бұрын
Awesome tutorial!!! This video just gave a idea for a new project Building a Custom Mailing Enterprise Software now. Thanks a lot!!
@al-taie4 жыл бұрын
You can use (quick-mailer) module, to send email in two lines of code, with a lot of options. al-taie.github.io/quick-mailer
@debjitchattopadhyay76274 жыл бұрын
@@al-taie thanks 👍
@wilberrosales63453 жыл бұрын
YOU ARE THE GOAT COREY
@daegudude10485 жыл бұрын
Corey, can you post some of useful website such as documentations that are related to this video? Your video is really helpful but after that when I try other variations or face some problems, I am not able to do go through the problems. It would be really helpful where you have watched resource/documents for the video. You are the best!
@jthomassaldias2 жыл бұрын
Corey, i have some problems running the code if I write it as shown, but when copied to my VS it does ran great. Thank you for this great tutorial.
@tgani965 жыл бұрын
on 17:01 minute that way Im trying to connect to host but it gives me error using 465 port raise SMTPServerDisconnected("Connection unexpectedly closed") smtplib.SMTPServerDisconnected: Connection unexpectedly closed
@prashanthenuganti7363 жыл бұрын
Very clear and simple.
@RaoAnilYadav2 жыл бұрын
Hello Corey, Thank you very much for this video. It's extremely clear, fast pace, super useful. BR, Anil
@axvex5953 жыл бұрын
when I search: myaccount.google.com/apppasswords it gives me an error that says: The setting you are looking for is not available for your account.
@Kosyyy_3 жыл бұрын
I'm getting this error, please help " with smtplib.SMTP ('smtp.gmail.com', 25) as smtp: AttributeError: SMTP instance has no attribute '__exit__' "
@afzalkhan22885 жыл бұрын
Multithreading in python --- please cover this
@victormaia41923 жыл бұрын
Thanks! This video made de subject more clear to me and I could follow the ressults
@kamaldhungana66772 жыл бұрын
you explained things very nicely!
@imrealeddieuk Жыл бұрын
Now that imghdr is depreciated. What would you recommend as a replacement?
@amirroohi45665 жыл бұрын
Amazing channel, subscribing right away
@martind543 жыл бұрын
Corey, thank you very much for this video. It's extremely clear, fast pace, super useful. Thanks mate!
@sol51795 жыл бұрын
Super useful! Thank you.
@romankh53384 жыл бұрын
Loving your work! Thank you!
@al-taie4 жыл бұрын
You can use (quick-mailer) module, to send email in two lines of code, with a lot of options check out here: al-taie.github.io/quick-mailer
@yashindane28442 жыл бұрын
Thanks for the amazing video ☺️
@danielrosas22404 жыл бұрын
Thank u so much, Corey! Greetings from Mexico!
@pratikmahamuni48564 жыл бұрын
Great video, thank you for the tutorial. Very thorough! One question: How can the html string email have logos that are created as PNGs or JPEGs?
@al-taie4 жыл бұрын
You can use (quick-mailer) module, to send email in two lines of code. al-taie.github.io/quick-mailer
@yltfy4 жыл бұрын
Another wonderful video!
@al-taie4 жыл бұрын
You can use (quick-mailer) module, to send email in two lines of code, with a lot of options. check out here: al-taie.github.io/quick-mailer
@benko61714 жыл бұрын
This is so helpful you have noooooooooo idea. Thank you cory!
@VCodeIt2 жыл бұрын
Thanks a lot, It is just splendid explanation.
@estanka3 жыл бұрын
Is it possible to attach the contents of a word document, keeping the html formatting?
@TechnicalGuruji_Satish2 жыл бұрын
Could you please make video on how to retrieve file directly from AWS S3 and send it in attachment
@simplyviki3 жыл бұрын
thanks sir, will it be different configuration/code/packages if I want to run python script on a linux server to distribute emails with attached csv/pdf?
@jitheshkuyyalil2 жыл бұрын
works like a charm, thank you
@RokkamRithwik9 ай бұрын
Thanks for the video. Its was very helpful
@soumitralahiri1003 жыл бұрын
Excellent video Corey! The steps were very clearly explained and worked without any issues. One question - the example that you provide is for including multiple attachments to a single email; however, if I wish to include the list of attachments to individual emails (one attachment per email), what would be the best way to proceed? I have looked this up in details and not found a satisfactory solution. Will greatly appreciate your help with this.
@mayoufmohamedanis5337 Жыл бұрын
Very intuitive !
@matthewelliott43194 жыл бұрын
I had been using smtplib.SMTP with the ehlo and starttls for awhile. Nice to know there is a more elegant way to do the same thing with smtp.SMTP_SSL. Thanks for the video!
@alexvallex54873 жыл бұрын
where do i put the app password in the code?
@yltfy4 жыл бұрын
Great video. Just one question: was your email box bombed by test emails from the viewers in the end?
@kiwiworldbykiwi3 жыл бұрын
I wanted to add an attachement image and I typed the exacte same thing you did. but, it says there is an attribute error of ‘str’ object has no attribute ‘add_attachement’ What should I do?
@dlmoney11 Жыл бұрын
Is there a way to hide the recipients form other recipients when sending?
@getfit91334 жыл бұрын
Hello good video...im wondring how can i add ip rotation to my app and tracking link?
@portfedh3 жыл бұрын
This was really helpful. Thank you very much!
@md.fazleyrafy80155 жыл бұрын
beginner's question: I generated a password protected app named "Python test" in my Gmail settings and wrote the program in Py-charm IDE script. But I did not receive any email as you did? can you tell me what am I doing wrong there?
@ivanbeltrame26984 жыл бұрын
Great tutorial !
@al-taie4 жыл бұрын
You can use (quick-mailer) module, to send email in two lines of code, with a lot of options. check out here: al-taie.github.io/quick-mailer
@darkspl5 жыл бұрын
Could you make some toturial for creation of document like in word /pdf with specific elements(fields) that must be taken from mutliple(also online) sources? Amazing toturial sir!!
@scifregizmoguy5 жыл бұрын
Beginner's Question: Can someone explain to me what this localhost thing is at 10:15 ? I don't know what a terminal is... I run Windows. I've been using Anaconda, but I know how to save and run a python file too. Just not the terminal thing.
@coreyms5 жыл бұрын
Hey there. You can do this on Windows as well. Do you know how to open your command-line in Windows? You should be able to open your start menu and then type "cmd" to find it.
@scifregizmoguy5 жыл бұрын
@@coreyms Oh hey, Corey! You really help out. EDIT: Turns out I was using multiple terminals, also terminals within Jupyter. I have success using one now. Thanks, man, great videos!
@medizinmagdeburg5445 жыл бұрын
Thanks for your work!
@milindkhobragade8772 жыл бұрын
Thanks for the tut, as always it's very informative and explanatory. You covered all but html content is visible in the mail and not the plain text which you set by msg.set_content("This is a plain text email") in the line 16. Would you please explain, I'm stuck at that point since 2 days.
@narendranani74244 жыл бұрын
Very good video with nice 👍 explanation Nd good tips to improvisation as well..
@claylanzino97493 жыл бұрын
Very well. Thanks for Sharing.
@stayatohm2 жыл бұрын
17:25 adding attachments explination starts
@rakhshandamujib27934 жыл бұрын
Love it! Thank you for being so amazing!
@al-taie4 жыл бұрын
You can use (quick-mailer) module, to send email in two lines of code, with a lot of options. check out here: al-taie.github.io/quick-mailer
@fundtrading2 жыл бұрын
Hello what are you blasting with 🤞
@muhammadsaepudin67865 жыл бұрын
Helpfull👏 thanks sir!
@al-taie4 жыл бұрын
You can use (quick-mailer) module, to send email in two lines of code, with a lot of options. check out here: al-taie.github.io/quick-mailer