Page 87 - Python Cơ Bản
P. 87

+ЮM IQEMP Gɹ чɴRL OɯQ JMPI





          &ϰR G϶R Wм HдRK XLɱQ GPEWW %XXEGLQIRX чВ XϰS


          EXXEGLQIRX






           from sender import Mail, Message, Attachment




           mail = Main(...)

           msg = Message(..)

           ...


           # Open attached file and create Attachment object


           with open("photo01.jpg") as f:

               file01 = Attachment("photo01.jpg", "image/jpeg"

           , f.read())



           msg.attach(file01)


           # Send message


           mail.send(msg)





                8ɳQ LMВY XLɱQ






          &ϰR Gɹ XLВ XɳQ LMВY XLɱQ ZА XLš ZMЖR  sender  XϰM [IFWMXI
   82   83   84   85   86   87   88   89   90   91   92