A
alex23
This same message comes up under one of Niko's many aliases. Is this
another? Why post twice?
Because he's a troll.
This same message comes up under one of Niko's many aliases. Is this
another? Why post twice?
That is because you changed TO in [TO]. That causes the error.Ferrous Cranus said:I this hoq you mean? [...]
SUBJECT = u"Mail από τον επισκÎπτη: ( %s )" % FROM
MESSAGE = "\nFrom: %s\r\n" + "To: %s\r\n" + "Subject: %s\r\n\r\n" % ( FROM, [TO], SUBJECT ) + MESSAGE + "\r\n"
MESSAGE = MESSAGE.encode('utf-8') [...]
but now iam getting this error message:
sendmail => %s 13-09-04 12:29:22 (<class 'TypeError'>, TypeError('not all arguments converted during string formatting',), <traceback object at 0x7f0e432e1cb0>)
** And the \n at the beginning shouldn't be there. **
MESSAGE = "From: %s\r\n" + "To: %s\r\n" + "Subject: %s\r\n\r\n" % ( FROM, TO, SUBJECT ) + MESSAGE + "\r\n"
You could even change that to:
MESSAGE = "From: %s\r\n" + "To: %s\r\n" + "Subject: %s\r\n\r\n%s\r\n" % (FROM, TO, SUBJECT, MESSAGE)
which I think is nicer.
UBJECT = u"SuperHost Guest Mail από τον [ %s ]" % FROM
MESSAGE = "From: %s\n" + "To: %s\n" + "Subject: %s\n\n%s\n" % (FROM, TO,
SUBJECT, MESSAGE)
MESSAGE = MESSAGE.encode('utf-8')
but i still get the same error messgae
The error messge says:Even though these examples are with ints, not strings, the precedence is
the same.
Go back to your code. Read your code. Does it look closer to this:
8 + 2 % 5
or this?
(8 + 2) % 5
Can you solve this problem now?
Yes Steven, according to your precedence example now i can:
MESSAGE = ( "From: %s\n" + "To: %s\n" + "Subject: %s\n\n%s\n" ) % (
FROM, TO, SUBJECT, MESSAGE )
MESSAGE = MESSAGE.encode('utf-8')
it just need the whole concatenation thing in parenthesis so to be
executed first but now:
# send the mail
server.sendmail( [ MESSAGE ] )
or
# send the mail
server.sendmail( MESSAGE )
both fail.
(e-mail address removed) [~]# cat /tmp/err.out
sendmail => 13-09-05 12:20:53 (<class 'TypeError'>,
TypeError("sendmail() missing 2 required positional arguments:
'to_addrs' and 'msg'",), <traceback object at 0x7f3fb4f44488>)
(e-mail address removed) [~]#
but all of the needed args are within MESSAGE.
Cant it take it from there?
is there way to alter tha FROM field to the one used in the webform by(e-mail address removed) [~]# cat /tmp/err.out
sendmail => 13-09-05 12:20:53 (<class 'TypeError'>,
TypeError("sendmail() missing 2 required positional arguments:
'to_addrs' and 'msg'",), <traceback object at 0x7f3fb4f44488>)
(e-mail address removed) [~]#
but all of the needed args are within MESSAGE.
Cant it take it from there?
Do you know how to find a link like this?
http://docs.python.org/3.3/library/smtplib.html#smtplib.SMTP.sendmail
Yes it ist. You did it in your code.is there way to alter tha FROM field to the one used in the webform by
the visitor?
Yes. Already answered:GMail adds the Sender by default is there some other service that
doesn't and use the FROM field?
And again, you did not care to read / understand the answers you got.Am 03.09.2013 09:48, schrieb Ferrous Cranus:
Yes, use/setup your own mailserver. Google will not allow you to send
as ("i.e., From:") an arbitrary address besides the one you've
authenticated as.
And again, you did not care to read / understand the answers you got.
So again: You are a troll.
And you can solve this promblem by asking "How can I change the FROM field with python?" (which was your last question in this context, after you readand understood the cited answers)? ... Good luck!Στις 5/9/2013 2:02 μμ, ο/η feedthetroll ÎγÏαψε:
I'm perfectly awra of the answers given to me. I do car to read them and
do care to udnerstand them.
I need information on how to setup my own mail server
i cannot even connect to my 'mail.mydomain.com' mail server like i do
with GMail's.
See above.So:
server = smtplib.SMTP(localhost)
doesn't help, i cannot efen connect to my localhost mail server form
within my script.
No problem. Configure your own mail server the way you want it to work.An alternative is needed, one that doesnt add up things as Sender but
uses fROM field isntead.
Beeing serious:
Which mailserver did you install? postfix, exim, sendmail, ...?
Check that and read its dokumentation how to configure authentication.
Then you can use it.
And if you get stuck: A python list is NOT THE RIGHT PLACE to ask questions about the configuration of mailservers. Find the correct list for your mailserver and ask there!
WHM (http://www.globalacronyms.com/whm):Στις 5/9/2013 3:18 μμ, ο/η feedthetroll ÎγÏαψε:
My WHM
OK, I should have been more exact:uses DoveCot as enaled mail server but i have no idea how to
setip up to work.
i cannot connect to it via my python script.
http://www.dovecot.org/documentation.html - but DoveCot won't help you here..i looked over at my WHM for configuration but i didnt find out how to
properly configure it.
OK, I should have been more exact:
To send mails you need a "smtp-server" (MTA - Mail Transfer Agent, Message Transport Agent) like postfix, exim, sendmail, ...
DoveCot is good for "reading" mail (="mailbox management", "pop3(s)", "imap(s)"). You cannot send mails using DoveCot. (You can use a WebMailService to access DoveCot for reading and a MTA for sending mails.)
So you have to find out, which MTA you installed (you have root access, don't you) and configure it.
But this is (like so often) becoming extremely offtopic.
Missing "nss-config-dir" variable.Στις 5/9/2013 4:29 μμ, ο/η (e-mail address removed) ÎγÏαψε:OK, I should have been more exact:
To send mails you need a "smtp-server" (MTA - Mail Transfer Agent,
Message Transport Agent) like postfix, exim, sendmail, ...
DoveCot is good for "reading" mail (="mailbox management", "pop3(s)",
"imap(s)"). You cannot send mails using DoveCot. (You can use a
WebMailService to access DoveCot for reading and a MTA for sending
mails.)
So you have to find out, which MTA you installed (you have root
access, don't you) and configure it.
But this is (like so often) becoming extremely offtopic.
i as root just inatslled
sendmail and mailx. i have edited the ~/.mailrc to use:
(e-mail address removed) [~/www/cgi-bin]# cat ~/.mailrc
account gmail {
set smtp-use-starttls
set smtp=smtp://smtp.gmail.com:587
set smtp-auth=login
set smtp-auth-user=may)gmail
set smtp-auth-password=my_gmail_pass_not_stupid_enough_to_wite _it_again
}
And now i'm trying to:
cmd = "echo %s | mailx -A gmail -r %s -s %s %s" % (MESSAGE, FROM,
SUBJECT, TO)
p=subprocess.Popen( cmd, shell=True, stdout=subprocess.PIPE )
output, errors = p.communicate()
print( errors, output )
Any ideas please why this fails to work?
while i remove the '-A gmail' string in the cmd line then i can send
fast mail but only to mail containing the @superhost.gr trail.
i need to be eble to send to external mails to.
Don't use gmail. Gmail is the cause of your problem. As long as you use it (whatever way you use) the problem will persist. USE YOUR SENDMAIL.Στις 5/9/2013 4:29 μμ, ο/η feedthetroll ÎγÏαψε:OK, I should have been more exact:
To send mails you need a "smtp-server" (MTA - Mail Transfer Agent,
Message Transport Agent) like postfix, exim, sendmail, ...
DoveCot is good for "reading" mail (="mailbox management", "pop3(s)",
"imap(s)"). You cannot send mails using DoveCot. (You can use a
WebMailService to access DoveCot for reading and a MTA for sending mails..)
So you have to find out, which MTA you installed (you have root access,
don't you) and configure it.
But this is (like so often) becoming extremely offtopic.
i as root just inatslled
sendmail and mailx. i have edited the ~/.mailrc to use:
(e-mail address removed) [~/www/cgi-bin]# cat ~/.mailrc
account gmail {
set smtp-use-starttls
set smtp=smtp://smtp.gmail.com:587
set smtp-auth=login
set smtp-auth-user=may)gmail
set smtp-auth-password=my_gmail_pass_not_stupid_enough_to_wite _it_again
}
DONT INVOKE THIS VIA PYTHON. Use the shell. If it works there, you can try it with python.And now i'm trying to:
cmd = "echo %s | mailx -A gmail -r %s -s %s %s" % (MESSAGE, FROM,
SUBJECT, TO)
p=subprocess.Popen( cmd, shell=True, stdout=subprocess.PIPE )
output, errors = p.communicate()
print( errors, output )
THIS IS NOT A SENDMAIL LIST!Any ideas please why this fails to work?
while i remove the '-A gmail' string in the cmd line then i can send
fast mail but only to mail containing the @superhost.gr trail.
i need to be eble to send to external mails to.
Ferrous Cranus said:it just need the whole concatenation thing in parenthesis so to be
executed first but now:
# send the mail
server.sendmail( [ MESSAGE ] )
or
# send the mail
server.sendmail( MESSAGE )
both fail.
pok i will ask to sendmail listAm Donnerstag, 5. September 2013 15:38:25 UTC+2 schrieb Ferrous Cranus:Don't use gmail. Gmail is the cause of your problem. As long as you use it (whatever way you use) the problem will persist. USE YOUR SENDMAIL.Στις 5/9/2013 4:29 μμ, ο/η feedthetroll ÎγÏαψε:uses DoveCot as enaled mail server but i have no idea how to
setip up to work.
i cannot connect to it via my python script.
OK, I should have been more exact:
To send mails you need a "smtp-server" (MTA - Mail Transfer Agent,
Message Transport Agent) like postfix, exim, sendmail, ...
DoveCot is good for "reading" mail (="mailbox management", "pop3(s)",
"imap(s)"). You cannot send mails using DoveCot. (You can use a
WebMailService to access DoveCot for reading and a MTA for sending mails.)
So you have to find out, which MTA you installed (you have root access,
don't you) and configure it.
But this is (like so often) becoming extremely offtopic.
i as root just inatslled
sendmail and mailx. i have edited the ~/.mailrc to use:
(e-mail address removed) [~/www/cgi-bin]# cat ~/.mailrc
account gmail {
set smtp-use-starttls
set smtp=smtp://smtp.gmail.com:587
set smtp-auth=login
set smtp-auth-user=may)gmail
set smtp-auth-password=my_gmail_pass_not_stupid_enough_to_wite _it_again
}
DONT INVOKE THIS VIA PYTHON. Use the shell. If it works there, you can try it with python.And now i'm trying to:
cmd = "echo %s | mailx -A gmail -r %s -s %s %s" % (MESSAGE, FROM,
SUBJECT, TO)
p=subprocess.Popen( cmd, shell=True, stdout=subprocess.PIPE )
output, errors = p.communicate()
print( errors, output )
THIS IS NOT A SENDMAIL LIST!Any ideas please why this fails to work?
while i remove the '-A gmail' string in the cmd line then i can send
fast mail but only to mail containing the @superhost.gr trail.
i need to be eble to send to external mails to.
Solve your sendmail-problem and then, if it still does not work from python come back with a smart question.
FUP: comp.mail.sendmail
Take a look at:ok i will ask to sendmail list
mailx is a MUA (Mail User Agent) used to read and write mails.but tell me please mailx and senmail are 2 differnt MTAs or mailx makes
use of sendmail MTA?
(e-mail address removed) [~]# cat /tmp/err.out sendmail => 13-09-05 12:20:53
(<class 'TypeError'>, TypeError("sendmail() missing 2 required
positional arguments: 'to_addrs' and 'msg'",), <traceback object at
0x7f3fb4f44488>) (e-mail address removed) [~]#
but all of the needed args are within MESSAGE. Cant it take it from
there?
but tell me please mailx and senmail are 2 differnt MTAs or mailx makes
use of sendmail MTA?
Want to reply to this thread or ask your own question?
You'll need to choose a username for the site, which only take a couple of moments. After that, you can post your question and our members will help you out.