Hi I am trying to send out an email through smtplib, I want to keep the username different from the login username. It is giving me an error when I used a shared mailbox which I do have the permission to send and revive emails and port number and works fine with smtp.office365.com.
Anyone know why?
Thank for your help.
server = smtplib.SMTP("ccc.ccccc.com", 88)
server.ehlo()
server.starttls()
me = "xxxxxxx@xxx.com"
my_pwd = "xxxxxxxx"
you = ["xxxxxx@xxx.com"]
msg = MIMEMultipart('alternative')
msg['From'] = "yyyyyyyyy@yyy.com"
msg['To'] = ','.join(you)
body = MIMEText(html, 'html')
msg.attach(body)
server.login(me, my_pwd)
server.sendmail(me, you,msg.as_string())
server.quit()