<html><head><style type="text/css"><!-- DIV {margin:0px;} --></style></head><body><div style="font-family:times new roman, new york, times, serif;font-size:12pt"><DIV><BR></DIV>
<DIV style="FONT-FAMILY: times new roman, new york, times, serif; FONT-SIZE: 12pt"><BR>
<DIV style="FONT-FAMILY: times new roman, new york, times, serif; FONT-SIZE: 12pt"><FONT size=2 face=Tahoma>----- Forwarded Message ----<BR><B><SPAN style="FONT-WEIGHT: bold">From:</SPAN></B> sandric ionut <sandricionut@yahoo.com><BR><B><SPAN style="FONT-WEIGHT: bold">To:</SPAN></B> Dave Angel <davea@ieee.org><BR><B><SPAN style="FONT-WEIGHT: bold">Sent:</SPAN></B> Tue, August 31, 2010 3:56:40 PM<BR><B><SPAN style="FONT-WEIGHT: bold">Subject:</SPAN></B> Re: sendmail error<BR></FONT><BR>
<DIV style="FONT-FAMILY: times new roman, new york, times, serif; FONT-SIZE: 12pt">
<DIV><BR></DIV>
<DIV style="FONT-FAMILY: times new roman, new york, times, serif; FONT-SIZE: 12pt"><BR><FONT size=2 face=Tahoma>
<DIV style="FONT-FAMILY: arial, helvetica, sans-serif; FONT-SIZE: 10pt">
<HR SIZE=1>
</DIV>
<DIV style="FONT-FAMILY: arial, helvetica, sans-serif; FONT-SIZE: 10pt"><B><SPAN style="FONT-WEIGHT: bold">From:</SPAN></B> Dave Angel <davea@ieee.org><BR><B><SPAN style="FONT-WEIGHT: bold">To:</SPAN></B> sandric ionut <sandricionut@yahoo.com><BR><B><SPAN style="FONT-WEIGHT: bold">Cc:</SPAN></B> Python List <python-list@python.org><BR><B><SPAN style="FONT-WEIGHT: bold">Sent:</SPAN></B> Tue, August 31, 2010 2:49:29 PM<BR><B><SPAN style="FONT-WEIGHT: bold">Subject:</SPAN></B> Re: sendmail error<BR></FONT><BR>sandric ionut wrote:<BR>> Hello:<BR>> <BR>> I have a script for sending email from python (it is attached bellow). When I am launching the script I get the error:<BR>> TypeError: cannot concatenate 'str' and 'type' objects if I use sys.argv[1], but if I input from the begging an email address like "<A href="mailto:email@email.com" rel=nofollow target=_blank ymailto="mailto:email@email.com">email@email.com</A>", the script
 is working OK<BR>> <BR>> What could be the problem?<BR>> <BR>> Thank you,<BR>> <BR>> Ionut<BR>> <BR>> import<BR>> mesaj = email.MIMEMultipart.MIMEMultipart()<BR>> fromEmail = sys.argv[<BR>> toEmail = os, sys, smtplib, email1]"toEmail"mesaj[<BR>> mesaj[<BR>> mesaj["From"] = fromEmail"To"] = toEmail"Subject"] = "Teste"mesaj[<BR>> atasament = r"Date"] = email.Utils.formatdate(localtime=True)"d:\Doc1.zip"atasamentP = email.MIMEBase.MIMEBase(<BR>> atasamentP.set_payload(open(atasament,<BR>> email.Encoders.encode_base64(atasamentP)<BR>> atasamentP.add_header(<BR>> mesaj.attach(atasamentP)<BR>> mesaj.attach(email.MIMEText.MIMEText(<BR>> smtpObj = smtplib.SMTP('application','zip')"rb").read())'Content-Disposition','attachement;<BR>>  filename="%s"'% os.path.basename(atasament))"Email transmis la data: ", email.Utils.formatdate(localtime=False)))"192.168.1.2")try<BR>>
 smtpObj.sendmail(fromEmail, toEmail, mesaj.as_string())<BR>> smtpObj.close():exceptsmtplib.SMTPException:print"eroare: "+ smtplib.SMTPException<BR>> <BR>> <BR>>  <BR>  Three things:  When quoting code, do it exactly, and without wordwrap in your mail program.  There are so many typos in that code sample that it's     useless, presumably because you didn't use copy/paste</DIV>
<DIV style="FONT-FAMILY: arial, helvetica, sans-serif; FONT-SIZE: 10pt"> </DIV>
<DIV style="FONT-FAMILY: arial, helvetica, sans-serif; FONT-SIZE: 10pt">The code was COPY and PASTE -> presume wrong<BR><BR>   When quoting an error message, get it all.  Since you omit the stacktrace part, we can't tell what line might be giving you that error</DIV>
<DIV style="FONT-FAMILY: arial, helvetica, sans-serif; FONT-SIZE: 10pt"> </DIV>
<DIV style="FONT-FAMILY: arial, helvetica, sans-serif; FONT-SIZE: 10pt">That is all the error code!!!<BR><BR>    Once you've noticed which line, just examine the types of each of the elements you're combining.  If you're using the + operator, and the left operand is a string, then the right one must also be string.  Figure out why it's not and you have your own answer</DIV>
<DIV style="FONT-FAMILY: arial, helvetica, sans-serif; FONT-SIZE: 10pt"> </DIV>
<DIV style="FONT-FAMILY: arial, helvetica, sans-serif; FONT-SIZE: 10pt">Do you really think that I didn't do it? What a... response. This + or , is really USELESS. Please don't bother to send useless replays</DIV>
<DIV style="FONT-FAMILY: arial, helvetica, sans-serif; FONT-SIZE: 10pt">This is the line where I get the error: smtpObj.sendmail(fromEmail, toEmail, mesaj.as_string())</DIV>
<DIV style="FONT-FAMILY: arial, helvetica, sans-serif; FONT-SIZE: 10pt"> </DIV>
<DIV style="FONT-FAMILY: arial, helvetica, sans-serif; FONT-SIZE: 10pt">I.S.<BR><BR>DaveA<BR><BR>>       </DIV></DIV></DIV><BR></DIV></DIV></div><br>

      </body></html>