Logo Questions Linux Laravel Mysql Ubuntu Git Menu
 

Python Emailing - Use of colon causes no output

Tags:

python

email

Really odd experience with this which took me over an hour to figure out. I have a cgi script written in python which takes form data and forwards it to an email, the problem was, if there was a colon in the string it would cause python to output nothing to the email.

Does anyone know why this is?

For example:

output = "Print- Customer"

works, though:

output = "Print: Customer"

prints no output.

My email function works essentially:

server.sendmail(fromaddr, toaddrs, msg)

where msg = output

Just wondering if the colon is a special character in python string output

like image 683
Kilizo Avatar asked Sep 03 '11 18:09

Kilizo


1 Answers

Colon isn't a special character in python string output, but it is special to email headers. Try inserting a blank line in the output:

output = "\nPrint: Customer"
like image 87
Russell Borogove Avatar answered Oct 02 '22 18:10

Russell Borogove