So im trying to make a fun little application thingy, wich sends an email (with my gmail to my gmail for testing) (using python 3.7.0) and i tried putting like info in it but it displays an error, how do i make sure the message can be sent? btw i just replaced my mail with my mail and password by password haha. note i only showed a part of the code here
code:
code:
import smtplib server = smtplib.SMTP('smtp.gmail.com', 587) server.starttls() server.login("my-emaim", "password") msg = "Hello, my name is", name, lastname, ", I am a", age, "year old", gender, ". I live in", country, adress, ". Thank you for reading my E-mail." server.sendmail("mymail", "mymail", msg) server.quit()error:
Error:Traceback (most recent call last):
File "C:\Users\Balder\Documents\Applicant.py", line 28, in <module>
server.sendmail("[email protected]", "[email protected]", msg)
File "C:\Users\Balder\AppData\Local\Programs\Python\Python37-32\lib\smtplib.py", line 882, in sendmail
(code, resp) = self.data(msg)
File "C:\Users\Balder\AppData\Local\Programs\Python\Python37-32\lib\smtplib.py", line 564, in data
q = _quote_periods(msg)
File "C:\Users\Balder\AppData\Local\Programs\Python\Python37-32\lib\smtplib.py", line 176, in _quote_periods
return re.sub(br'(?m)^\.', b'..', bindata)
File "C:\Users\Balder\AppData\Local\Programs\Python\Python37-32\lib\re.py", line 192, in sub
return _compile(pattern, flags).sub(repl, string, count)
TypeError: expected string or bytes-like object