#!/usr/bin/python
import os
for i in range(1,500):
cmd = '/var/indimail/bin/vadduser mal'+str(i)+'@domain.com password'
os.system(cmd)
print cmd
indimail batch user adding like:
mail1@domain.com with password
mail2@domain.com with password
mail3@domain.com with password
..
..
Reading UTF-8 Files
You can manually convert strings that you read from files, however there is an easier way:
import codecs
fileObj = codecs.open( "someFile", "r", "utf-8" )
u = fileObj.read() # Returns a Unicode string from the UTF-8 bytes in the file
The codecs module will take care of all the conversions for you. You can also open a file for writing and it will convert the Unicode strings you pass in to write into whatever encoding you have chosen. However, take a look at the note below about the byte-order marker (BOM).

Writing a Python program can be done using any editor, even a text editor. If you are running Ubuntu Linux, you may want to edit your code using Eclipse. Eclipse is an Integrated Development Environment or IDE for building, deploying and managing software. It is a source code editor and provides trace and debugging facilities. The Eclipse Project was originally created by IBM in November 2001 and supported by a consortium of software vendors. Today, the Eclipse community consists of individuals and organizations from a cross section of the software industry.
(more…)
smtplib.SMTPAuthenticationError 535 authorization failed (#5.7.1
[root@proxy1 ~]# ./mail.py
send: ‘ehlo sender.host.net\r\n’
reply: ‘250-smtp.host.net\r\n’
reply: ‘250-AUTH LOGIN PLAIN CRAM-MD5\r\n’
reply: ‘250-AUTH=LOGIN PLAIN CRAM-MD5\r\n’
reply: ‘250-PIPELINING\r\n’
reply: ‘250-8BITMIME\r\n’
reply: ‘250-SIZE 10000000\r\n’
reply: ‘250-ETRN\r\n’
reply: ‘250-ATRN\r\n’
reply: ‘250 HELP\r\n’
reply: retcode (250); Msg: smtp.host.net
AUTH LOGIN PLAIN CRAM-MD5
AUTH=LOGIN PLAIN CRAM-MD5
PIPELINING
8BITMIME
SIZE 10000000
ETRN
ATRN
HELP
send: ‘STARTTLS\r\n’
reply: ‘454 TLS missing certificate: error:02001002:system library:fopen:No such file or directory (#4.3.0)\r\n’
reply: retcode (454); Msg: TLS missing certificate: error:02001002:system library:fopen:No such file or directory (#4.3.0)
send: ‘AUTH CRAM-MD5\r\n’
reply: ‘334 ***************************=\r\n’
reply: retcode (334); Msg: ***************************=
send: ‘ ***************************\r\n’
reply: ‘535 authorization failed (#5.7.1)\r\n’
reply: retcode (535); Msg: authorization failed (#5.7.1)
Traceback (most recent call last):
File “./mail.py”, line 31, in ?
smtpserver.login(sender,password)
File “/usr/lib64/python2.4/smtplib.py”, line 587, in login
raise SMTPAuthenticationError(code, resp)
smtplib.SMTPAuthenticationError: (535, ‘authorization failed (#5.7.1)’)
solution
ADD redline after ehlo()
…
smtpserver.ehlo()
smtpserver.esmtp_features["auth"] = “LOGIN PLAIN”
smtpserver.starttls()
..
also you can pass into debug mode with “smtpserver.set_debuglevel(1)“
ignore_user_abort() — Set whether a client disconnect should abort script execution
Sets whether a client disconnect should cause a script to be aborted.
When running PHP as a command line script, and the script’s tty goes away without the script being terminated then the script will die the next time it tries to write anything, unless value is set to TRUE
call the function at top of the script like this:
// Ignore user aborts and allow the script
// to run forever
ignore_user_abort(true);
set_time_limit(0);
be careful before call it, it can be dangerous, you can need a “httpd restart” or server can fire cause of loads
i just found a new mail server daemon, developed with python twisted
codes are simple and can be implemented quickly.
project home: https://launchpad.net/txmailserver
to download :
bzr branch lp:txmailserver
The code is based on the popularly used dda line drawing algorithm.It picks up two point from the window and change the color of pixels which are closest to vectorial line between them.
(more…)
There is lots of xml reading methods and classes. Some of them is too compicated. if you want to read xml with real php and simpliest way, u can use this code
(more…)
How to Use Template Class or Function in C++ (Stack Implemantation)
1-How to use a function with different data types in c++. i mean, i have a function
that name is abs() and i want to use it just like this:
int x;foo(x); or
float x;foo(x); or
char x;foo(x)…
(more…)
Python Morse Converter
Maybe one day you can meet an asume alien girl however she don’t know any language except morse alphabet (she communicates only this way:-)). So, what will you do? Dont be sad cause i wrote a python code to decode what she says and encode yours.
(more…)