miguelgrinberg / microblog

The microblogging application developed in my Flask Mega-Tutorial series. This version maps to the 2024 Edition of the tutorial.
http://blog.miguelgrinberg.com/post/the-flask-mega-tutorial-part-i-hello-world
MIT License
4.52k stars 1.62k forks source link

Chapter 7 -Listing 63: Email without from-adress and subject #393

Open Michael2302 opened 4 months ago

Michael2302 commented 4 months ago

With listing 63, there is no from-adress and no subject in the sended email. Maybe there is a change in SMTPHandler. My provider works with SSL/TLS so I have to change your listing and work with smtplib.SMTP_SSL. In this case I also changed the formatting of the mail-handler and use email.message for the message. After that all works ok. I've attached my listing, so you can have a look at my solution. Sorry for my poor english. Michael Listing 63 init .txt

miguelgrinberg commented 4 months ago

I don't understand why the from address and subject are missing for you, since they are set in the code.

Michael2302 commented 4 months ago

If no one else had this problem I think the problem sits in front of my keyboard. Maybe it happens while I tried to implement SSL/TLS. However, I continue to read your outstanding book. Thank you for your patience.

CyCyCy777 commented 4 months ago

I'm having trouble running your code and was hoping you could help me out.

I entered the code in terminal 1: aiosmtpd -n -c aiosmtpd.handlers.Debugging -l localhost:8025

In terminal 2 I entered the code: set MAIL_SERVER=localhost set MAIL_PORT=8025 flask run

and successfully triggered the SQLAlchemy error, but instead of receiving the error log email in Terminal 1, it prints a stack trace of all the errors in Terminal 1, what's going on here?

Anyway, I will continue to learn from this great tutorial of yours. Thanks for your patience.