Python Forum
[split] Script has stopped working
Thread Rating:
  • 2 Vote(s) - 3.5 Average
  • 1
  • 2
  • 3
  • 4
  • 5
[split] Script has stopped working
#1
hello everyone i am using this script  for mail sending it will sending through gmail but i am  unable to send through my office mail (smtp) i am sending gmail to office but i am unable to send office mail to office or outside mail  can you  help me any once
-----------------------------------------------------------------------------------------------------------------------------------------------------------
import smtplib
from email.MIMEMultipart import MIMEMultipart
from email.MIMEBase import MIMEBase
from email.MIMEText import MIMEText
from email import Encoders
import os

gmail_user = " [email protected]"
gmail_pwd = "password"

def mail(to, subject, text, attach):
  msg = MIMEMultipart()

  msg['From'] = gmail_user
  msg['To'] = to
  msg['Subject'] = subject

  msg.attach(MIMEText(text))

  part = MIMEBase('application', 'octet-stream')
  part.set_payload(open(attach, 'rb').read())
  Encoders.encode_base64(part)
  part.add_header('Content-Disposition',
          'attachment; filename="%s"' % os.path.basename(attach))
  msg.attach(part)

  mailServer = smtplib.SMTP("smtp.gmail.com", 587)
  mailServer.ehlo()
  mailServer.starttls()
  mailServer.ehlo()
  mailServer.login(gmail_user, gmail_pwd)
  mailServer.sendmail(gmail_user, to, msg.as_string())
  # Should be mailServer.quit(), but that crashes...
  mailServer.close()

mail("[email protected]",
  "Beeam line up!",
  "This is a email sent with python  Beeam lines UP Please check",
  "my_picture.jpg")
Reply


Messages In This Thread
[split] Script has stopped working - by santhosh - Feb-27-2017, 01:07 PM
RE: [split] Script has stopped working - by Ofnuts - Feb-27-2017, 03:21 PM

Possibly Related Threads…
Thread Author Replies Views Last Post
  [split] Help- converting file with pyton script eltomassito 6 3,287 Jul-02-2021, 05:29 PM
Last Post: snippsat
  Spyder stopped working in Windows 10 gammaray 3 3,094 Apr-19-2021, 05:33 PM
Last Post: jefsummers
  for loop script over telnet in Python 3.5 is not working abhijithd123 1 2,911 May-10-2020, 03:22 AM
Last Post: bowlofred
  [split] script: remove all "carriage return" from my json variable pete 2 2,816 May-05-2020, 03:22 PM
Last Post: deanhystad
  countdown script not working..plz help what is mistake randyjack 1 2,123 Oct-28-2019, 06:57 AM
Last Post: perfringo
  Pyautogui script runs fine if split into two parts together it does not Bmart6969 1 2,551 Oct-07-2019, 10:53 PM
Last Post: Bmart6969
  picamera not working on premade script georgeaura 1 2,538 Jul-24-2019, 10:11 AM
Last Post: gontajones
  python has stopped working sally 1 6,031 Nov-22-2018, 10:19 PM
Last Post: metulburr
  Split not working morgandebray 3 3,125 Aug-09-2018, 09:34 AM
Last Post: morgandebray
  mkdtemp spontaneously stopped working reliably last night saporta98 1 2,833 Apr-16-2018, 05:12 PM
Last Post: nilamo

Forum Jump:

User Panel Messages

Announcements
Announcement #1 8/1/2020
Announcement #2 8/2/2020
Announcement #3 8/6/2020