#1
|
|||
|
|||
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 "<string>", line 11, in <module> File "C:\Users\Stephanie\Documents\Works1.py", line 72, in <module> 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 |
|
|
Similar Threads | ||||
Thread | Thread Starter | Forum | Replies | Last Post |
Realistic Light and Shadows Using Vizard and 3DS Max | jde | Vizard | 4 | 07-13-2012 10:58 AM |
Sending data to Vizard via UDP | rlh001 | Vizard | 1 | 04-05-2011 04:14 PM |
Vizard 4 Beta Testing | farshizzo | Announcements | 0 | 02-01-2011 10:46 AM |
Vizard 4 Beta Testing | farshizzo | Vizard | 0 | 02-01-2011 10:46 AM |
Vizard tech tip: Using the Python Imaging Library (PIL) | Jeff | Vizard | 0 | 03-23-2009 11:13 AM |