SMTP AUTH extension not supported by server

9,244 views
Skip to first unread message

songokoussj2

unread,
Jun 16, 2008, 4:40:05 AM6/16/08
to Google App Engine
Hi there,
i tried to use gmail's smtp server for the dev_appserver but it does
not work. POP3 is activated and the dev_appserver settings are
configured properly. Tried it with different ports but nothing works.
Using another smtp server (smtp.web.de) everything works fine. I use
the django helper but this should not be the problem (because web's
smtp server works).
Using gmail's smtp server i get the exception:
SMTP AUTH extension not supported by server

Can someone help me out?
Thanks

David Symonds

unread,
Jun 16, 2008, 4:50:52 AM6/16/08
to google-a...@googlegroups.com
On Mon, Jun 16, 2008 at 6:40 PM, songokoussj2 <Songok...@gmail.com> wrote:

> i tried to use gmail's smtp server for the dev_appserver but it does
> not work.

Why can't you use your ISPs SMTP server?

> POP3 is activated and the dev_appserver settings are
> configured properly.

POP3 has nothing to do with sending mail. It is only for receiving mail.


Dave.

songokoussj2

unread,
Jun 16, 2008, 5:26:18 AM6/16/08
to Google App Engine
>> Why can't you use your ISPs SMTP server?

I want to use my gmail accout.

> POP3 has nothing to do with sending mail. It is only for receiving mail.

Activated POP3 for other reasons, sorry.

David Symonds

unread,
Jun 16, 2008, 7:02:17 AM6/16/08
to google-a...@googlegroups.com
On Mon, Jun 16, 2008 at 7:26 PM, songokoussj2 <Songok...@gmail.com> wrote:
>
>>> Why can't you use your ISPs SMTP server?
>
> I want to use my gmail accout.

This is using the dev_appserver, so what does it matter? If you want
to get copies of the emails, just add yourself to the Cc or Bcc list
when making the emails.


Dave.

songokoussj2

unread,
Jun 17, 2008, 5:31:46 AM6/17/08
to Google App Engine


On Jun 16, 1:02 pm, "David Symonds" <dsymo...@gmail.com> wrote:
> This is using the dev_appserver, so what does it matter? If you want
> to get copies of the emails, just add yourself to the Cc or Bcc list
> when making the emails.

The point is that gmail does not work for sending mails so there might
be a bug and i want to find out this bug or my mistake.

David Symonds

unread,
Jun 17, 2008, 5:38:27 AM6/17/08
to google-a...@googlegroups.com
On Tue, Jun 17, 2008 at 7:31 PM, songokoussj2 <Songok...@gmail.com> wrote:

> The point is that gmail does not work for sending mails so there might
> be a bug and i want to find out this bug or my mistake.

It sounds like just a missing feature, not so much a "bug". You can
always just file a bug ticket about it, though.


Dave.

Waldemar Kornewald

unread,
Jun 17, 2008, 4:50:54 PM6/17/08
to Google App Engine
Hi,

On 17 Jun., 11:38, "David Symonds" <dsymo...@gmail.com> wrote:
> On Tue, Jun 17, 2008 at 7:31 PM, songokoussj2 <SongokouS...@gmail.com> wrote:
> > The point is that gmail does not work for sending mails so there might
> > be a bug and i want to find out this bug or my mistake.
>
> It sounds like just a missing feature, not so much a "bug". You can
> always just file a bug ticket about it, though.

OK, I have the same problem and it's very strange.

The problem is this:

If you run
dev_appserver.py --smtp_host=smtp.yourisp.com ... .
it works.

But if you run
dev_appserver.py --smtp_host=smtp.gmail.com ... --smtp_port=587 .
it doesn't work.

Neither port 25 nor 587 work. The exception "SMTP AUTH extension not
supported by server" is raised. I've found out what the problem is:
dev_appserver.py doesn't support TLS, but GMail requires it. After I
inserted a little code snippet into api/mail_stub.py it can
successfully send mail via the GMail SMTP server:
After smtp.connect(self._smtp_host, self._smtp_port) I inserted:
smtp.ehlo()
smtp.starttls()
smtp.ehlo()
of course, it should actually check whether TLS should be used. :)

But there is another bug: dev_appserver.py is using the email API
incorrectly. In line 153 it says:
smtp.sendmail(mime_message['From'], tos, str(mime_message))
but it should be mime_message.as_string() because str(mime_message)
returns a format that looks more like mbox (beginning with the string
"From nobody Tue Jun ...") and thus isn't a valid email message. Some
servers still accepted it, but we always received a broken mail. Other
servers immediately rejected the mail. With the change to
mime_message.as_string() everything finally works as expected.

Bye,
Waldemar

songokoussj2

unread,
Jun 18, 2008, 1:33:47 PM6/18/08
to Google App Engine


On 17 Jun., 22:50, Waldemar Kornewald <wkornew...@freenet.de> wrote:

Thanks

Brett Morgan

unread,
Jun 18, 2008, 5:11:13 PM6/18/08
to google-a...@googlegroups.com
Can you raise this in the bug tracker so that it gets fixed in the
mainline code?

http://code.google.com/p/googleappengine/issues/list

--

Brett Morgan http://brett.morgan.googlepages.com/

Waldemar Kornewald

unread,
Jun 18, 2008, 5:49:42 PM6/18/08
to Google App Engine
On 18 Jun., 23:11, "Brett Morgan" <brett.mor...@gmail.com> wrote:
> Can you raise this in the bug tracker so that it gets fixed in the
> mainline code?
>
> http://code.google.com/p/googleappengine/issues/list

Already done yesterday.

Bye,
Waldemar

justin

unread,
Jul 24, 2008, 12:06:17 PM7/24/08
to Google App Engine
Waldemar,

thank you--you helped me track down a problem I was having using
django's send_mail() function.

if anyone else is getting the error "SMTP AUTH extension not supported
by server" when trying to use google smtp, here's what I did to
resolve the problem (it builds off of Waldemar's suggestions):

In your settings.py, make sure the following is present:

# These settings are used to authenticate to the SMTP server
EMAIL_HOST = "smtp.gmail.com"
EMAIL_PORT = "587"
EMAIL_HOST_USER = "your_accoun...@gmail.com"
EMAIL_HOST_PASSWORD = "your_secret_password"
# Controls whether a secure connection is used.
EMAIL_USE_TLS = True

Now, in order to make the send_mail() function work, navigate to your
django/core directory and open "mail.py"

In the send_mass_mail(...) function, there is a try block where the
line
server = smtplib.SMTP(settings.EMAIL_HOST, settings.EMAIL_PORT)
is present. (around line 66 in version .96)

Change this try block to include the following:

try:
server = smtplib.SMTP(settings.EMAIL_HOST,
settings.EMAIL_PORT)
if auth_user and auth_password:
if settings.EMAIL_USE_TLS: # deliberately start tls if
using TLS
server.ehlo()
server.starttls()
server.ehlo()
server.login(auth_user, auth_password)

After saving and restarting apache (I'm using WebFaction for hosting),
I was able to send email.

Good luck.

Milos Milovanovic

unread,
May 1, 2019, 9:40:05 AM5/1/19
to Google App Engine
Thank you Waldemar!!! This also worked for me!!!
(Just to mention for others, you need to setup you gmail account to allow use of less secure apps in order to use this way of sending emails)
Reply all
Reply to author
Forward
0 new messages