Fw: sendmail error
sandric ionut
sandricionut at yahoo.com
Tue Aug 31 08:57:14 EDT 2010
----- Forwarded Message ----
From: sandric ionut <sandricionut at yahoo.com>
To: Dave Angel <davea at ieee.org>
Sent: Tue, August 31, 2010 3:56:40 PM
Subject: Re: sendmail error
________________________________
From: Dave Angel <davea at ieee.org>
To: sandric ionut <sandricionut at yahoo.com>
Cc: Python List <python-list at python.org>
Sent: Tue, August 31, 2010 2:49:29 PM
Subject: Re: sendmail error
The code was COPY and PASTE -> presume wrong
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
That is all the error code!!!
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
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
This is the line where I get the error: smtpObj.sendmail(fromEmail, toEmail,
mesaj.as_string())
I.S.
DaveA
>
sandric ionut wrote:
> 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 "email at 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','attachement;
>
> 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
>
>
>
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
-------------- next part --------------
An HTML attachment was scrubbed...
URL: <http://mail.python.org/pipermail/python-list/attachments/20100831/d37aa26c/attachment-0001.html>
More information about the Python-list
mailing list