Sending an email from Vizard
I have a script that asks the user to fill out a form with fields such as name, class, instructor,...
The script creates a text file with this information and stores it in a folder.I would like to automatically e-mail this text file when the script is over. I am using the code below: # Import smtplib for the actual sending function import smtplib # Import the email modules we'll need from email.MIMEText import MIMEText # Open a plain text file for reading. For this example, assume that # the text file contains only ASCII characters. fp = open(file path+textFileName.txt, 'rb') # Create a text/plain message msg = MIMEText(fp.read()) fp.close() # me == the sender's email address # you == the recipient's email address msg['Subject'] = 'The contents of %s' % file path+textFileName.txt msg['From'] = 'xyz@abc.com' msg['To'] = 'xyz@abc.com' # Send the message via our own SMTP server, but don't include the # envelope header. s = smtplib.SMTP() s.connect() s.sendmail(me, [you], msg.as_string()) s.close() I am getting this error: Traceback (most recent call last): File " File "C:\Users\Stephanie\Documents\Works1.py", line 72, in s = smtplib.SMTP('localhost') File "C:\Program Files (x86)\WorldViz\Vizard4\bin\lib\smtplib.py", line 239, in __init__ (code, msg) = self.connect(host, port) File "C:\Program Files (x86)\WorldViz\Vizard4\bin\lib\smtplib.py", line 295, in connect self.sock = self._get_socket(host, port, self.timeout) File "C:\Program Files (x86)\WorldViz\Vizard4\bin\lib\smtplib.py", line 273, in _get_socket return socket.create_connection((port, host), timeout) File "C:\Program Files (x86)\WorldViz\Vizard4\bin\lib\socket.py", line 571, in create_connection raise err socket.error: [Errno 10013] An attempt was made to access a socket in a way forbidden by its access permissions Thanks |
All times are GMT -7. The time now is 09:31 AM. |
Powered by vBulletin® Version 3.8.7
Copyright ©2000 - 2024, vBulletin Solutions, Inc.
Copyright 2002-2023 WorldViz LLC