This is the only message that I will send to this list regarding my question:
1. I have copied and paste my code from Eclipe PyDev and I have used web interface for yahoo email to send the email. I don't know why the message arrived like that. I consider that the message from Dave was rude and just a replay considering the structure of the script would have been enough 2. Regarding the useless of the question: I consider that you two are also rude! There are some many more "useless" questions than my question on this forum! Do not bother to replay to this email because I would not receive the message. Your replays were enough to make me unsubscribe from the list I.S. ________________________________ From: Thomas Jollans <tho...@jollybox.de> To: python-list@python.org Sent: Tue, August 31, 2010 4:46:58 PM Subject: Re: sendmail error On Tuesday 31 August 2010, it occurred to sandric ionut to exclaim: > Hello: > > I have a script for sending email from python (it is attached bellow). When > I am launching the script I get the error: > TypeError: cannot concatenate 'str' and 'type' objects if I use > sys.argv[1], but if I input from the begging an email address like > "em...@email.com", the script is working OK > > What could be the problem? > > Thank you, > > Ionut > > import > mesaj = email.MIMEMultipart.MIMEMultipart() > fromEmail = sys.argv[ > toEmail = os, sys, smtplib, email1]"toEmail"mesaj[ > mesaj[ > mesaj["From"] = fromEmail"To"] = toEmail"Subject"] = "Teste"mesaj[ > atasament = r"Date"] = > email.Utils.formatdate(localtime=True)"d:\Doc1.zip"atasamentP = > email.MIMEBase.MIMEBase( > atasamentP.set_payload(open(atasament, > email.Encoders.encode_base64(atasamentP) > atasamentP.add_header( > mesaj.attach(atasamentP) > mesaj.attach(email.MIMEText.MIMEText( > smtpObj = > smtplib.SMTP('application','zip')"rb").read())'Content-Disposition','attach > ement; filename="%s"'% os.path.basename(atasament))"Email transmis la data: > ", email.Utils.formatdate(localtime=False)))"192.168.1.2")try > smtpObj.sendmail(fromEmail, toEmail, mesaj.as_string()) > smtpObj.close():exceptsmtplib.SMTPException:print"eroare: "+ > smtplib.SMTPException I struggle to imagine what one might do to a piece of code to garble it this badly. If this was actually the script you're trying to run, then it would have blown up in your face with a angry SyntaxError, not the helpful TypeError you quoted. As far as I can see, you never actually use sys.argv[1], so this can't be the right code. To paraphrase what you failed to spell correctly in your other message, please don't bother sending useless inquiries to this list. If you want to get a useful reply, please: - Quote the code correctly. Before sending, check that it actually makes sense. The above is quite simply nothing like Python. - Quote the entire stack trace and error message. You might have looked at it already, but we haven't. This information is not useless! Also, when replying: - Quote properly. While top posting is discouraged, the most important bit is to clearly distinguish quoted material from new material. Make it possible from the structure of the message you're sending which parts you wrote and which parts you're just quoting. - Keep your reply on-list. - Thomas -- http://mail.python.org/mailman/listinfo/python-list
-- http://mail.python.org/mailman/listinfo/python-list