0

I know similar questions have been asked already, but this is an exception. I'm trying to send mail from my school ID which is powered by google, but smtp.gmail.com authorization fails.

Also the school smtp cluster, says my account is not authorised to use it.

I used an alias from my other gmail ID, but the receiver explicitly sees which ID it is coming from. Is there a way around it ? This is my code :

import smtplib
from email.MIMEMultipart import MIMEMultipart
from email.MIMEText import MIMEText

msg = MIMEMultipart()
msg['From'] = 'me@gmail.com'
msg['To'] = 'you@gmail.com'
msg['Subject'] = 'simple email in python'
message = 'here is the email'
msg.attach(MIMEText(message))

mailserver = smtplib.SMTP("SCHOOL SMTP HERE",587)
# identify ourselves to smtp gmail client
mailserver.ehlo()
# secure our email with tls encryption
mailserver.starttls()
# re-identify ourselves as an encrypted connection
mailserver.ehlo()
mailserver.login(username, pwd)

mailserver.sendmail(from,to,msg.as_string())

mailserver.quit()
dj007
  • 11
  • 4
  • look at this: https://stackoverflow.com/questions/540976/specify-a-sender-when-sending-mail-with-python-smtplib – MrE Aug 09 '17 at 23:45
  • you can forge the From display name, but you cannot forge the From email. – MrE Aug 09 '17 at 23:45
  • yeah i tried what's in that link. I want to forge the from email basically. I want it to be from my school email and not gmail. – dj007 Aug 10 '17 at 00:03

0 Answers0