Mail extraction problem (something's wrong with split methods)

Luka Milkovic luka.milkovic at
Sun Sep 12 11:53:32 CEST 2004

On Sat, 11 Sep 2004 20:11:42 +0200, Diez B. Roggisch wrote:

> That certainly has _nothing_ to do with the size of 350 - this snippet
> works perfect:
> len(",".join([str(i) for i in xrange(20000)]).split(','))

The thing you said here led me to a tiny clue. The splitting code is
actually not the source of the problem: i made a list looking just like
ordinary e-mail many bytes long and it did it's job great.
The clue I was thinking about is e-mail format. Is there a possibility
that mails get specially formated after a particular size? Because, my
splitting code works great, but the source of the problem is obviously
e-mail, I checked temporary file into which e-mail is saved _before_
spliting and it too contains this strange quotes.

My mailing code looks like this:

def prompt(prompt):
  return raw_input(prompt).strip()
posiljatelj = prompt("From: ")                   
primatelj = prompt("To: ").split()               
host = prompt("SMTP host: ")                     
subject = "OTP"                                  
msgin = priv                                     
x = "\n---Code block---\n"
msg = ("From: %s\r\nTo: %s\r\nSubject: %s\r\n\r\n"
  % (posiljatelj, string.join(primatelj, ", "), subject))  
msg = msg + x + msgin + x                        
print "Vas e-mail: ", msg                        
print ""
print "Duljina vaseg maila je " + `len(msg)` + " bajtova"     
server = smtplib.SMTP(host)                      
server.sendmail(posiljatelj, primatelj, msg)     

I don't think there is problem in my actual SMTP code, it's more likely
that the problem lies inside the protocol itself or some special formating
style, I don't know.

> As I proved above, it has nothing to do with that. Unless you provide
> actual data I can't say more. I can only guess that 350 bytes has
> something to do with line-boundaries or similar stuff - you hit some
> sort of special case you didn't thing of or such a thing.
> Do post the data, and I'm sure things will be sorted out soon.

What should I actually post?

Thank you very much Diez, I appreciate your help.

More information about the Python-list mailing list