WorldViz User Forum  

Go Back   WorldViz User Forum > Vizard

Reply
 
Thread Tools Rate Thread Display Modes
  #1  
Old 01-22-2012, 11:08 AM
starlingstm starlingstm is offline
Member
 
Join Date: May 2011
Posts: 19
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
Reply With Quote
Reply

Thread Tools
Display Modes Rate This Thread
Rate This Thread:

Posting Rules
You may not post new threads
You may not post replies
You may not post attachments
You may not edit your posts

BB code is On
Smilies are On
[IMG] code is On
HTML code is Off

Forum Jump

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


All times are GMT -7. The time now is 09:52 AM.


Powered by vBulletin® Version 3.8.7
Copyright ©2000 - 2024, vBulletin Solutions, Inc.
Copyright 2002-2023 WorldViz LLC