I tested it again,
I created a new scaffolding app with the admin interface then I
changed:
db.py:
mail=Mail() # mailer
mail.settings.server='localhost:25' # your SMTP server
mail.settings.sender='pr...@localhost' # your email
default.py (controller)
def index():
"""
example action using the internationalization operator T and flash
rendered by views/default/index.html or views/generic.html
"""
response.flash = T('mailtest')
context=dict(name="Gipsz Jakab",
addr="Szt. Erzsébet körút")
message=response.render('emailbody.txt', context)
mail.send(to="szimszon",
subject="test email",
message=message)
return dict(message=T('Mail sent'))
made an emailbody.txt in views:
emailbody.txt
Üdvözlöm {{=name}}!
Címed: {{=addr}}
Ez egy teszt elektronikus levél.
Árvíztűrő tükörfúrógép!
------------------
Then I navigate to the site to send myself a letter:
----- cut -----
>From pr...@localhost Thu Feb 25 11:24:05 2010
Return-Path: <pr...@localhost>
X-Original-To: szimszon
Delivered-To: szims...@xxxxxxxxxxxxx
Received: from xxxxxxxxxxxxxxx (localhost [127.0.0.1])
by xxxxxxxxxxx (Postfix) with ESMTP id C542A31CBF
for <szimszon>; Thu, 25 Feb 2010 11:24:05 +0100 (CET)
Content-Type: multipart/related;
boundary="===============1518445122=="
MIME-Version: 1.0
To: szims...@xxxxxxxxxxxxxxxx
Subject: test email
Message-Id: <20100225102405.c542a31...@xxxxxxxxxxxxxxx>
Date: Thu, 25 Feb 2010 11:24:05 +0100 (CET)
From: pr...@localhost
--===============1518445122==
Content-Type: multipart/alternative;
boundary="===============1974471883=="
MIME-Version: 1.0
--===============1974471883==
Content-Type: text/plain; charset="us-ascii"
MIME-Version: 1.0
Content-Transfer-Encoding: 8bit
Üdvözlöm Gipsz Jakab!
Címed: Szt. Erzsébet körút
Ez egy teszt elektronikus levél.
Árvíztűrő tükörfúrógép!
--===============1974471883==--
--===============1518445122==--
----- cut -----
charset: us-ascii
If I changed the
mail.send(to="szimszon",
subject="test email",
message=message)
to
mail.send(to="szimszon",
subject="test email",
message=message,
encoding="utf-8")
made no difference :(
On febr. 23, 21:01, Thadeus Burgess <[email protected]> wrote:
> I am unable to replicate this.
>
> -Thadeus
>
>
>
> On Tue, Feb 23, 2010 at 1:59 PM, szimszon <[email protected]> wrote:
> > No change:
>
> > --===============2046819983==
> > Content-Type: multipart/alternative;
> > boundary="===============1304182396=="
> > MIME-Version: 1.0
>
> > --===============1304182396==
> > Content-Type: text/plain;charset="us-ascii"
> > MIME-Version: 1.0
> > Content-Transfer-Encoding: 7bit
>
> > On febr. 23, 20:47, Thadeus Burgess <[email protected]> wrote:
> >> Have you tried
>
> >>mail.send(encoding='us-ascii') ?
>
> >> -Thadeus
>
> >> On Tue, Feb 23, 2010 at 1:33 PM, szimszon <[email protected]> wrote:
> >> > Okay. I see...
>
> >> > The default is utf-8 and if I set it to utf-8 manually there is no
> >> > difference. This is the generatedmailcontent :( :
>
> >> > --===============1981490134==
> >> > Content-Type: multipart/alternative;
> >> > boundary="===============0000859693=="
> >> > MIME-Version: 1.0
>
> >> > --===============0000859693==
> >> > Content-Type: text/plain;charset="us-ascii"
> >> > MIME-Version: 1.0
> >> > Content-Transfer-Encoding: 7bit
>
> >> > On febr. 23, 20:06, Thadeus Burgess <[email protected]> wrote:
> >> >> Your looking in the wrong place.
>
> >> >> lines 172-182
>
> >> >> On line 181 is the encoding.
>
> >> >>http://code.google.com/p/web2py/source/browse/gluon/tools.py#181
>
> >> >> def send(
> >> >> self,
> >> >> to,
> >> >> subject='None',
> >> >> message='None',
> >> >> attachments=None,
> >> >> cc=None,
> >> >> bcc=None,
> >> >> reply_to=None,
> >> >> encoding='utf-8'
> >> >> ):
>
> >> >> -Thadeus
>
> >> >> On Tue, Feb 23, 2010 at 12:34 PM, szimszon <[email protected]> wrote:
> >> >> > This is the sniplet of the most recent (1.75.4) web2py's tools.py's
> >> >> > classMail:
>
> >> >> > def __init__(self, server=None, sender=None, login=None,
> >> >> > tls=True):
> >> >> > """
> >> >> > MainMailobject
> >> >> > Arguments::
> >> >> > server: SMTP server address in address:port notation
> >> >> > sender: sender email address
> >> >> > login: sender login name and password in login:password
> >> >> > notation
> >> >> > or None if no authentication is required
> >> >> > tls: enables/disables encryption (True by default)
>
> >> >> > I can't do another, the file is dated:
> >> >> > tools.py │ 113589│febr 18 21.57
>
> >> >> > Is it old?
>
> >> >> > On febr. 23, 17:32, Thadeus Burgess <[email protected]> wrote:
> >> >> >>Mailhas an encoding variable, unless you are running an older version
> >> >> >> of web2py.
>
> >> >> >> The code you posted is for the attachment class.
>
> >> >> >> -Thadeus
>
> >> >> >> On Tue, Feb 23, 2010 at 3:05 AM, szimszon <[email protected]> wrote:
> >> >> >> > tools.py │ 113589│febr 18 21.57
>
> >> >> >> > classMail(object):
> >> >> >> > """
> >> >> >> > Class for configuring and sending emails with alternative text /
> >> >> >> > html
> >> >> >> > body, multiple attachments and encryption support
>
> >> >> >> > Works with SMTP and Google App Engine.
> >> >> >> > """
>
> >> >> >> > class Attachment(MIMEBase.MIMEBase):
> >> >> >> > """
> >> >> >> > Email attachment
>
> >> >> >> > ...
> >> >> >> > def __init__(self, server=None, sender=None, login=None,
> >> >> >> > tls=True):
> >> >> >> > """
> >> >> >> > MainMailobject
>
> >> >> >> > Arguments::
>
> >> >> >> > server: SMTP server address in address:port notation
> >> >> >> > sender: sender email address
> >> >> >> > login: sender login name and password in login:password
> >> >> >> > notation
> >> >> >> > or None if no authentication is required
> >> >> >> > tls: enables/disables encryption (True by default)
>
> >> >> >> > ...
>
> >> >> >> > So it's a most recent version of tools.py fresh from
> >> >> >> >http://www.web2py.com/examples/static/web2py_src.zip:) and there
> >> >> >> > isn't any encoding just
> >> >> >> > server=None, sender=None, login=None, tls=True
>
> >> >> >> > On febr. 23, 09:30, mdipierro <[email protected]> wrote:
> >> >> >> >> You may have an old version
>
> >> >> >> >> classMail:
> >> >> >> >> def __init__(
> >> >> >> >> self,
> >> >> >> >> payload,
> >> >> >> >> filename=None,
> >> >> >> >> content_id=None,
> >> >> >> >> content_type=None,
> >> >> >> >> encoding='utf-8')
>
> >> >> >> > this init is for class Attachment
>
> >> >> >> > I don't want to include attachments I'll only send plaintext
> >> >> >> > messages
> >> >> >> > with Content-Type: text/plain;charset="utf-8" :)
>
> >> >> >> >> On Feb 23, 2:23 am, szimszon <[email protected]> wrote:
>
> >> >> >> >> > I got:
>
> >> >> >> >> > File
> >> >> >> >> > "/home/szimszon/fejlesztes/sajat/web2py/applications/raktar/
> >> >> >> >> > models/db.py", line 43, in <module>
> >> >> >> >> > mail=Mail( encoding = "UTF-8" )
> >> >> >> >> > #
> >> >> >> >> > mailer
> >> >> >> >> > TypeError: __init__() got an unexpected keyword argument
> >> >> >> >> > 'encoding'
>
> >> >> >> >> > And I think my message is in utf8.
>
> >> >> >> >> > On febr. 23, 07:47, mdipierro <[email protected]> wrote:
>
> >> >> >> >> > > You either encode the message in utf8 (default) or you
> >> >> >> >> > > specify a
> >> >> >> >> > > different encoding= as argument ofMail
>
> >> >> >> >> > > On Feb 22, 1:30 pm, szimszon <[email protected]> wrote:
>
> >> >> >> >> > > > I wonder if somebody could turn me in the right direction?
>
> >> >> >> >> > > > On febr. 17, 09:16, szimszon <[email protected]> wrote:
>
> >> >> >> >> > > > > Hello!
>
> >> >> >> >> > > > > I like to send email with:
> >> >> >> >> > > > > context=dict(...)
> >> >> >> >> > > > > message=response.render( 'template.txt', context )
> >> >> >> >> > > > > mail.send( to = ['some email'],
> >> >> >> >> > > > > subject = 'proba',
> >> >> >> >> > > > > message = message,
> >> >> >> >> > > > > )
> >> >> >> >> > > > > There is some non-ASCII chars in the template, but I got
>
> >> >> >> >> > > > > Content-Type: text/plain;charset="us-ascii"
> >> >> >> >> > > > > MIME-Version: 1.0
> >> >> >> >> > > > > Content-Transfer-Encoding: 8bit
>
> >> >> >> >> > > > > And notcharset='utf-8' :(
>
> >> >> >> >> > > > > Can I change it somehow?
>
> >> >> >> >> > > > > Tnx.
>
> >> >> >> >> > > > > ...
>
> >> >> >> >> > > > > Date: Wed, 17 Feb 2010 09:10:53 +0100 (CET)
> >> >> >> >> > > > > From: [email protected]
>
> >> >> >> >> > > > > --===============1207362275==
> >> >> >> >> > > > > Content-Type: multipart/alternative;
> >> >> >> >> > > > > boundary="===============2040283988=="
> >> >> >> >> > > > > MIME-Version: 1.0
>
> >> >> >> >> > > > > --===============2040283988==
> >> >> >> >> > > > > Content-Type: text/plain;charset="us-ascii"
> >> >> >> >> > > > > MIME-Version: 1.0
> >> >> >> >> > > > > Content-Transfer-Encoding: 8bit
>
> >> >> >> >> > > > > Sziasztok!
>
> >> >> >> >> > > > > Új számla lett felvéve a rendszerbe az alábbi adatokkal:
>
> >> >> >> >> > > > > ========================================================
> >> >> >> >> > > > > Eladó : New-Network
> >> >> >> >> > > > > Számlaszám: ffgg45
>
> >> >> >> >> > > > > ....
>
> >> >> >> > --
> >> >> >> > You received this message because you are subscribed to the Google
> >> >> >> > Groups "web2py-users" group.
> >> >> >> > To post to this group, send email to [email protected].
> >> >> >> > To unsubscribe from this group, send email to
> >> >> >> > [email protected].
> >> >> >> > For more options, visit this group
> >> >> >> > athttp://groups.google.com/group/web2py?hl=en.
>
> >> >> > --
> >> >> > You received this message because you are subscribed to the Google
> >> >> > Groups "web2py-users" group.
> >> >> > To post to this group, send email to [email protected].
> >> >> > To unsubscribe from this group, send email to
> >> >> > [email protected].
> >> >> > For more options, visit this group
> >> >> > athttp://groups.google.com/group/web2py?hl=en.
>
> >> > --
> >> > You received this message because you are subscribed to the Google
> >> > Groups "web2py-users" group.
> >> > To post to this group, send email to [email protected].
> >> > To unsubscribe from this group, send email to
> >> > [email protected].
> >> > For more options, visit this group
> >> > athttp://groups.google.com/group/web2py?hl=en.
>
> > --
> > You received this message because you are subscribed to the Google Groups
> > "web2py-users" group.
> > To post to this group, send email to [email protected].
> > To unsubscribe from this group, send email to
> > [email protected].
> > For more options, visit this group
> > athttp://groups.google.com/group/web2py?hl=en.
--
You received this message because you are subscribed to the Google Groups
"web2py-users" group.
To post to this group, send email to [email protected].
To unsubscribe from this group, send email to
[email protected].
For more options, visit this group at
http://groups.google.com/group/web2py?hl=en.