Jul-12-2020, 04:44 PM
Hey,
So just a quick one before we get started:
Also: Comment out everything other than the email function to make sure the emailing works, then introduce the rest of the code and then we can go from there :-)
Regards,
Harley
So just a quick one before we get started:
EMAIL_ADDRESS = "*********@gmail.com" EMAIL_PASSWORD = "XXXX" msg = EmailMessage() msg['Subject'] = 'Email Subject' msg['From'] = '"*********@gmail.com' msg['To'] = sheet.cell_value(i, 3) # I replaced the 'To' email address here as I need the code to send email to the address from excel file msg.set_content("BODY OF EMAIL HERE") with smtplib.SMTP_SSL('smtp.gmail.com', 465) as smtp: smtp.login(EMAIL_ADDRESS, EMAIL_PASSWORD) smtp.send_message(msg)Is this ^ your exact code. Because as below:
EMAIL_ADDRESS = ""*********@gmail.com" EMAIL_PASSWORD = "XXXX" msg = EmailMessage() msg['Subject'] = 'Email Subject' msg['From'] = '"*********@gmail.com' msg['To'] = sheet.cell_value(i, 3) # I replaced the 'To' email address here as I need the code to send email to the address from excel file msg.set_content("BODY OF EMAIL HERE") with smtplib.SMTP_SSL('smtp.gmail.com', 465) as smtp: smtp.login(EMAIL_ADDRESS, EMAIL_PASSWORD) smtp.send_message(msg)"msg.set_content("BODY OF EMAIL HERE")" needs to be on its own line. ^
Also: Comment out everything other than the email function to make sure the emailing works, then introduce the rest of the code and then we can go from there :-)
Regards,
Harley