I have the following code to send mails through python to an email address. It's not working when I'm putting my work email address in the 'toaddrs' variable. It doesn't give an error, but I don't get any mails.But I'm able to send mails from and to the same address from the gmail through the browser. Can anyone help me figure out why it's not working?
import smtplib
fromaddr = 'my_address@gmail.com'
toaddrs = 'my_work_address@workdomain.com'
msg = 'Hello!'
username = 'my_address@gmail.com'
password = 'mypassword'
server = smtplib.SMTP('smtp.gmail.com:25')
server.starttls()
server.login(username,password)
server.sendmail(fromaddr,toaddrs,msg)
server.quit()