Quantcast
Channel: Active questions tagged email - Stack Overflow
Viewing all articles
Browse latest Browse all 29758

Sending multiple email using python

$
0
0

When I try to send multiple email using python I get this error

Traceback (most recent call last):
  File "emailsend.py", line 28, in <module>
    server.login('bloodnepal22@gmail.com', '*****')
  File "C:\Python37\lib\smtplib.py", line 730, in login
    raise last_exception
  File "C:\Python37\lib\smtplib.py", line 721, in login
    initial_response_ok=initial_response_ok)
  File "C:\Python37\lib\smtplib.py", line 642, in auth
    raise SMTPAuthenticationError(code, resp)
smtplib.SMTPAuthenticationError: (535, b'5.7.8 Username and Password not accepted. Learn more at\n5.7.8  https://support.google.com/mail/?p=BadCredentials h3sm11216819pji.9 - gsmtp')

Here is my python code.Even though my password is correct, it is throwing authentication error

subject="BloodNepal ask you for your help now"
sameMessage='Subject: {}\n\n{}'.format(subject,message)
fromMail='bloodnepal22@gmail.com'
context = ssl.create_default_context()
with smtplib.SMTP_SSL("smtp.gmail.com", 465, context=context) as server:
    server.login('bloodnepal22@gmail.com', *******)
    with open("emailsend.csv") as file:
        reader = csv.reader(file)
        next(reader)  # Skip header row
        for name, phoneNo, email in reader:
            server.sendmail(
                fromMail,
                email,
                sameMessage,
            )

Viewing all articles
Browse latest Browse all 29758

Trending Articles



<script src="https://jsc.adskeeper.com/r/s/rssing.com.1596347.js" async> </script>