help using smtplib to work ..
I'm using the following code to send e-mail through python:
import smtplib
fromaddr = '[EMAIL PROTECTED]'
toaddrs = '[EMAIL PROTECTED]'
subject = 'someting for subject !'
msg = 'This is body of the mail.'
msg = 'From: ' + fromaddr + '\nTo: ' + toaddrs + '\nSubject:' + subject
+ '\n\n' + msg
print "Message length is " + repr(len(msg))
server = smtplib.SMTP('smtp.gmail.com')
server.set_debuglevel(1)
server.sendmail(fromaddr, toaddrs, msg)
server.quit()
I have replaced the sender and receiver's mail address with the
original ones but executing this code I get the error (ip is hided for
obvious reason):
send: 'ehlo computer.domain_not_set.invalid\r\n'
reply: '250-mx.google.com at your service, [xxx.xx.xxx.xxx]\r\n'
reply: '250-SIZE 20971520\r\n'
reply: '250-8BITMIME\r\n'
reply: '250-STARTTLS\r\n'
reply: '250 ENHANCEDSTATUSCODES\r\n'
reply: retcode (250); Msg: mx.google.com at your service,
[xxx.xx.xxx.xxx]
SIZE 20971520
8BITMIME
STARTTLS
ENHANCEDSTATUSCODES
send: 'mail FROM:<[EMAIL PROTECTED]> size=106\r\n'
reply: '530 5.7.0 Must issue a STARTTLS command first
s1sm7666914uge\r\n'
reply: retcode (530); Msg: 5.7.0 Must issue a STARTTLS command first
s1sm7666914uge
send: 'rset\r\n'
reply: '250 2.1.0 Flushed s1sm7666914uge\r\n'
reply: retcode (250); Msg: 2.1.0 Flushed s1sm7666914uge
Traceback (most recent call last):
File "C:\Documents and Settings\NicolasG\Desktop\smtpexample.py",
line 17, in
server.sendmail(fromaddr, toaddrs, msg)
File "C:\Python25\lib\smtplib.py", line 684, in sendmail
raise SMTPSenderRefused(code, resp, from_addr)
SMTPSenderRefused: (530, '5.7.0 Must issue a STARTTLS command first
s1sm7666914uge', '[EMAIL PROTECTED]')
What am I doing wrong ?
--
http://mail.python.org/mailman/listinfo/python-list
Re: help using smtplib to work ..
>
>
> Under outgoing mail smtp server, use smtp.gmail.com. Since it requires SMTP
> authorization, use your Gmail account as username (e.g. [EMAIL PROTECTED]) and
> your Gmail password as password. You can turn TSL on or off.
>
>
>
> The email server requires authentication before it can send.
> Normally this can be accomplished either by calling
>
Actually I used alt1.gmail-smtp-in.l.google.com for a server I don't
need authentication. The problem is that for some mail addresses I can
send mail's while for other's I can't . I don't know how to explained
that.
> server.login(userid, password)
>
> The only alternative is to use an open relay email server that allows
> you to send without authenticating. Hope info at least points you in
> the right direction.
>
the code bellow worked fine to me :
import smtplib
fromaddr = '[EMAIL PROTECTED]'
toaddrs = '[EMAIL PROTECTED]'
subject = 'someting for subject !'
msg = 'This is body of the mail.'
msg = 'From: ' + fromaddr + '\nTo: ' + toaddrs + '\nSubject: ' +
subject + '\n\n' + msg
print "Message length is " + repr(len(msg))
server = smtplib.SMTP('alt1.gmail-smtp-in.l.google.com')
#'smtp.gmail.com')
server.set_debuglevel(1)
server.sendmail(fromaddr, toaddrs, msg)
server.quit()
cheers.
--
http://mail.python.org/mailman/listinfo/python-list
Python to tell what is the IP of my PC .
How can I use python to get the real IP address of my DSL router (when my PC is part of the local home LAN) ? -- http://mail.python.org/mailman/listinfo/python-list
integer to binary...
does anyone know a module or something to convert numbers like integer to binary format ? for example I want to convert number 7 to 0111 so I can make some bitwise operations... Thanks -- http://mail.python.org/mailman/listinfo/python-list
Re: integer to binary...
Grant Edwards wrote: > On 2006-06-01, [EMAIL PROTECTED] <[EMAIL PROTECTED]> wrote: > > > does anyone know a module or something to convert numbers like integer > > to binary format ? > > They _are_ in binary format. > > > for example I want to convert number 7 to 0111 so I can make some > > bitwise operations... > > Just do it: > > >>> 7 & 3 > 3 > >>> 7 | 8 > 15 > > > -- I know I can do that but I need to operate in every bit separeted. > Grant Edwards grante Yow! QUIET!! I'm being > at CREATIVE!! Is it GREAT >visi.comyet? It's s'posed to SMOKEY >THE BEAR... -- http://mail.python.org/mailman/listinfo/python-list
Re: integer to binary...
[EMAIL PROTECTED] wrote: > Grant Edwards wrote: > > On 2006-06-01, [EMAIL PROTECTED] <[EMAIL PROTECTED]> wrote: > > > > > does anyone know a module or something to convert numbers like integer > > > to binary format ? > > > > They _are_ in binary format. > > > > > for example I want to convert number 7 to 0111 so I can make some > > > bitwise operations... > > > > Just do it: > > > > >>> 7 & 3 > > 3 > > >>> 7 | 8 > > 15 > > > > this is exactly what I need -> http://www.daniweb.com/code/snippet285.html thanks. > > -- > I know I can do that but I need to operate in every bit separeted. > > Grant Edwards grante Yow! QUIET!! I'm being > > at CREATIVE!! Is it GREAT > >visi.comyet? It's s'posed to > > SMOKEY > >THE BEAR... -- http://mail.python.org/mailman/listinfo/python-list
File read and writing in binary mode...
Hi,
I'm trying to open a file (any file) in binary mode and save it inside
a new text file.
After that I want to read the source from the text file and save it
back to the disk with its original form. The problem is tha the binary
source that I extract from the text file seems to be diferent from the
source I saved. Here is my code:
1)
handle=file('image.gif','rb')
source=handle.read()
handle.close()
if I save the file directly everything is well :
2A)
handle=file('imageDuplicated.gif','wb')
handle.write(source)
handle.close()
the file imageDuplicated.gif will be exactly the same as the original
image.gif.
But if I save the source to a text file I have porblem :
2B)
handle=file('text.txt','w')
handle.write(source)
handle.close()
handle=file('text.txt','r')
source2=handle.read()
handle.close()
handle=file('imageDuplicated.gif','wb')
handle.write(source2)
handle.close()
the files are completly different and I even cant display the image
from the imageDuplicated.gif .
something changes when I save the source in the text file because in
2B) source == source2 returns a False .
I suspect that maybe the encoding is making a conflict but I don't know
how to manipulate it...
Every help is welcome, thanks.
--
http://mail.python.org/mailman/listinfo/python-list
Re: File read and writing in binary mode...
> > Solution: only use binary files, and do the newline-translation yourself > if needed. > > Diez The probelm is if I can't use only binary files... How can I do the newline-translation myself ? if check the text and found the diferrence between binary and text is the '\r' instead of '\'n' . I can't change every '\n' because it will change the real '\n' ones -- http://mail.python.org/mailman/listinfo/python-list
Python web service ...
Hi folks, I have accomplished to make a python program that make some image manipulation to bmp files. I now want to provide this program as a web service. A user can visit a site and through a web interface he should upload the file to the web server , the server then will do the image process with the python program I have wrote and when it finish the user must get the image file back . My question is how difficult is to set up a web server that can run python easy ? should I try ZOPE or there is something better in mind ? -- http://mail.python.org/mailman/listinfo/python-list
Re: Python web service ...
> For a one-shot thing, plain old CGI might be enough. You can have a > static HTML page with the form for the upload, have python do the > image part, and generate the return HTML with the image with a python > script. If you plan to do this a lot, or want fairly sophisticated > stuff, or DB access underneath, authentication, etc, then you might > want to look at any of the web framewoks. If you don't have the web > server part already taken care of (e.g., you already have Apache up > and running) then the web server framework can be more attractive. > > As for web frameworks there is a long list in the Python web site. > Which framework fits you best might depend on what you want to > accomplish now and in the future. You can try something simple and > minimalist (and with docs that you can read in less than an afternoon) > such as Karrigell, or try something more complex, such as Django, > TurboGears, Pylons, CherryPy, etc. > > And then, you might try the CGI approach to begin with, and as your > needs become more complex, move to a framework. (This has been our own > path: we've used plain CGI for over a year for the web-based > bioinformatics applications we've developed, that use R and Python for > computations, and are now moving to framework). > > Good luck! > > R. > > -- > Ramon Diaz-Uriarte At this time right now I prefer to do something that works the quickest possible... I never had any experience with CGI, do I need to set up a web server for that ? can you point me some usefull reading material so I can get a start ? I will post for a comment at Zope , I had installed once and it was very easy. Don't know if it will be easy too to get my job done... Gracias Ramon. -- http://mail.python.org/mailman/listinfo/python-list
Re: Python web service ...
You mean to use only python HTTP socket library ? I never had use sockets before, it has a big learning curve ? Gabriel Genellina wrote: > At Monday 28/8/2006 20:45, Nicolas G wrote: > > >If I want to run my program as a web service I need to setup a > >webserver , am I right ? > >Whars that difference ? can a webservice be run without a webserver ? > > Well, a webservice uses HTTP as its transport protocol, so you need > an HTTP server, but you don't have to use a full-blown web server to > implement it. SimpleHTTPServer > > in the standard library may be enough. > > > > Gabriel Genellina > Softlab SRL > > > > > > __ > Preguntá. Respondé. Descubrí. > Todo lo que querías saber, y lo que ni imaginabas, > está en Yahoo! Respuestas (Beta). > ¡Probalo ya! > http://www.yahoo.com.ar/respuestas -- http://mail.python.org/mailman/listinfo/python-list
I need Cryptogrphy in Python please .
Looking around for a Cryptography tool kit, the best recommendations I found about was for pyCrypto. I try to install it unsuccessfully in my windowsXP SP2 with python 2.4.3 and I get the following message : C:\Python24\pycrypto-2.0.1>python setup.py build running build running build_py running build_ext error: The .NET Framework SDK needs to be installed before building extensions f or Python. I have installed .NET framework latest release. Unfortunately the pyCrypto project looks abandoned , I couldn't find an active mailing list and the last release are a couple of year old. Can some one guide me how to fix the problem above or point me to another Cyrptography library that I can use easily ? Thanks. -- http://mail.python.org/mailman/listinfo/python-list
Re: I need Cryptogrphy in Python please .
I have made a site using Karrigell as a web server and I want to provide cryptography services to the visitors. They should wirte their text on the site and be able choose different encryption algorithms to apply on the text . MonkeeSage wrote: > NicolasG wrote: > > I have installed .NET framework latest release. > > The SDK is different from the framework. ;) How can I fix this ? > > > Can some one guide me how to fix the problem above or point me to > > another Cyrptography library that I can use easily ? > > Prebuilt binaries: > http://www.voidspace.org.uk/python/modules.shtml#pycrypto I need the modules source to use it with my web server. > Ps. The project still looks active to me, and has an active mailing > list: > http://www.amk.ca/python/code/crypto.html The last messages in the mailing list was on august (only one message) and the author does said that he does not reply to the this list , he point if anyone have an issue to use the bug trucker at sourceforge which looks not helpful ... cheers.. > Jordan -- http://mail.python.org/mailman/listinfo/python-list
Where do they tech Python officialy ?
Hi, I want to be a professional python programmer, unfortunately I'm working on technical support and don't have the time/patience to start making projects my self. I tried to apply to some Python positions but unfortunately sometimes to work as a programmer is really hard in this world, every employee requires professional experience and you can't really start as a beginner.. I'm planning to save some money and attend a course in any of the universities that teach hard core Python. Does some one have any suggestions on which University to attend ? Alternatives solutions are welcome.. Regards, Nicolas G. -- http://mail.python.org/mailman/listinfo/python-list
Re: Where do they tech Python officialy ?
> If you have a good programming background in other languages, you > should easily be able to pick up Python by reading the manual. > Dear all, thank you for your info. I forgot to mention that I already know how to program in Python (basic), my knowledge derives from a very good level of C (University level) and I have use python to build some pages in Zope plus some minor programs I created.. The problem is that I would like to work as a Python programmer but all the job vacancies I can find requires a couple of years of professional experience ... that I don't have. How a wanna be programmer can start working as a programmer if there is no chance to start from somewhere ? That's the reason I created this topic. -- http://mail.python.org/mailman/listinfo/python-list
Re: Where do they tech Python officialy ?
> Why would you want to become a programmer? Programmers smell bad, > they have no social life, they get treated like crap by everyone. > They can get paid pretty well but then they spend all the money on > useless electronic junk so they still live like bums. I wouldn't call this person programmer , I would call him a geek ;) > one reason to be a programmer, which is that the drive to program > burns in you like a fire. But in that case don't ask how to become a > programmer, because you are already one, so welcome to the ranks ;-). Yes true , I'm already a programmer.. doing technical support for my company products in a call center. I hate my job, I hate the moment I have to wake up to go work ! I hate that moment I have to go sleep when I think of the next working day morning. Python is what I like, I would love to be more creative with this language and be able to produce things that I can't right now.. Why not try to find a work that you would like ? I don't want to work as a programmer to became one because I'm already a programmer, I just want to work as a programmer .. -- http://mail.python.org/mailman/listinfo/python-list
How to create a single executable of a Python program
Dear fellows, I'm trying to create a executable file using py2exe . Unfortunately along with the python executable file it also creates some other files that are needed in order to the executable be able to run in a system that doesn't have Python installed. Can some one guide me on how can I merge all this files created by py2exe in a single exe file ? If I have a python program that uses an image file I don't want this image file to be exposed in the folder but only to be accessible through the program flow.. Regards, Nicolas. -- http://mail.python.org/mailman/listinfo/python-list
Re: How to create a single executable of a Python program
> You need to tell us why you "think" you need this and perhaps we can make a > suggestion. Question: Have you installed ANY applications recently that > consisted of only a single file on your hard drive? Answer: No. Most > applications install many (sometimes hundreds) of files. So what is the > problem. If you want a single file to distribute, look at Inno Installer. > Use > it to make a single, setup.exe out of all the files that come out of py2exe > along with documentation, shortcuts, etc. that a good modern application > needs. > > -Larry I "want" to create a single file for two of my very simple/small programs. For very simple/small programs I don't need to distribute documentation, shortcuts etc.. I just want a single file to run ! Another reason is that for another program I wrote has to do with displaying an Image file and I want that this image file can be visible only through my program and not exposed in the same directory where my program is located. Thank you all for the suggestions, I will try some methods you mentioned. Regards, Nicolas. -- http://mail.python.org/mailman/listinfo/python-list
Re: Where do they tech Python officialy ?
> Open source projects do not require previous professional experience to > accept volunteers. So, one way out of your dilemma is to make a name > for yourself as an open source contributor -- help out with Python > itself and/or with any of the many open source projects that use Python, > and you will both learn a lot _and_ acquire "professional experience" > that any enlightened employer will recognize as such. That will take a > while, but not as long as getting a college degree (and it will be far > cheaper than the degree). > > Alex I think this is the best idea to escape the python amateur circle and go in to open source project that are considered to be professional projects. I don't know if it will be better to find a project to contribute or to start a new one .. Will have a look around and think about. -- http://mail.python.org/mailman/listinfo/python-list
How to avoid reverse code engineering of a python executable
Hi guy's, Couple of day's ago I asked for your help on how to create a single file of a python executable. Now I want to proceed a little bit further asking how can I avoid (or at least make it difficult) for some one to extract my code by using reverse code engineer techniques? I came on pyobfuscate but I would like more suggestions and guide to achieve the most possible security in this matter. Regards, Nicoals. -- http://mail.python.org/mailman/listinfo/python-list
