Sign Up

Sign Up to our social questions and Answers Engine to ask questions, answer people’s questions, and connect with other people.

Have an account? Sign In

Have an account? Sign In Now

Sign In

Login to our social questions & Answers Engine to ask questions answer people’s questions & connect with other people.

Sign Up Here

Forgot Password?

Don't have account, Sign Up Here

Forgot Password

Lost your password? Please enter your email address. You will receive a link and will create a new password via email.

Have an account? Sign In Now

You must login to ask a question.

Forgot Password?

Need An Account, Sign Up Here

Please briefly explain why you feel this question should be reported.

Please briefly explain why you feel this answer should be reported.

Please briefly explain why you feel this user should be reported.

Sign InSign Up

The Archive Base

The Archive Base Logo The Archive Base Logo

The Archive Base Navigation

  • SEARCH
  • Home
  • About Us
  • Blog
  • Contact Us
Search
Ask A Question

Mobile menu

Close
Ask a Question
  • Home
  • Add group
  • Groups page
  • Feed
  • User Profile
  • Communities
  • Questions
    • New Questions
    • Trending Questions
    • Must read Questions
    • Hot Questions
  • Polls
  • Tags
  • Badges
  • Buy Points
  • Users
  • Help
  • Buy Theme
  • SEARCH
Home/ Questions/Q 5958717
In Process

The Archive Base Latest Questions

Editorial Team
  • 0
Editorial Team
Asked: May 22, 20262026-05-22T18:34:59+00:00 2026-05-22T18:34:59+00:00

I am trying to write a simple Python script to send emails through my

  • 0

I am trying to write a simple Python script to send emails through my company’s SMTP server. I am using the following piece of code.

#! /usr/local/bin/python

import sys,re,os,datetime
from smtplib import SMTP

#Email function
def sendEmail(message):
        sender="SENDERID@COMPANY.com"
        receivers=['REVEIVER1@COMPANY.com','RECEIVER2@COMPANY.com']
        subject="Daily Report - " + datetime.datetime.now().strftime("%d %b %y")
        header="""\
                From: %s
                To: %s
                Subject: %s

                %s""" % (sender, ", ".join(receivers), subject, message)
        smtp = SMTP()
        smtp.set_debuglevel(1)
        smtp.connect('X.X.X.X')
        smtp.ehlo()
        smtp.starttls()
        smtp.ehlo()
        try:
                smtp.login('SENDERID@COMPANY.com', '********')
                smtp.sendmail(sender,receivers,header)
                smtp.quit()
        except Exception, e:
                print e

#MAIN
sendEmail("HAHHAHAHAHAH!!!")

Running this program, yields this result.

connect: ('X.X.X.X', 25)
connect: ('X.X.X.X', 25)
reply: '220 COMPANY.com [ESMTP Server] service ready;ESMTP Server; 05/25/11 15:59:27\r\n'
reply: retcode (220); Msg: COMPANY.com [ESMTP Server] service ready;ESMTP Server; 05/25/11 15:59:27
connect: COMPANY.com [ESMTP Server] service ready;ESMTP Server; 05/25/11 15:59:27
send: 'ehlo SERVER1.COMPANY.com\r\n'
reply: '250-COMPANY.com\r\n'
reply: '250-SIZE 15728640\r\n'
reply: '250-8BITMIME\r\n'
reply: '250 STARTTLS\r\n'
reply: retcode (250); Msg: COMPANY.com
SIZE 15728640
8BITMIME
STARTTLS
send: 'STARTTLS\r\n'
reply: '220 Ready to start TLS\r\n'
reply: retcode (220); Msg: Ready to start TLS
send: 'ehlo SERVER2.COMPANY.com\r\n'
reply: '250-COMPANY.com\r\n'
reply: '250-SIZE 15728640\r\n'
reply: '250 8BITMIME\r\n'
reply: retcode (250); Msg: COMPANY.com
SIZE 15728640
8BITMIME
send: 'quit\r\n'
reply: '221 [ESMTP Server] service closing transmission channel\r\n'
reply: retcode (221); Msg: [ESMTP Server] service closing transmission channel
ERROR: Could not send email! Check the reason below.
SMTP AUTH extension not supported by server.

How do I start debugging this “SMTP AUTH extension not supported by server.” error?

P.S.: I know the SMTP details and credentials are correct, as I have a working Java class with the exact details.

  • 1 1 Answer
  • 0 Views
  • 0 Followers
  • 0
Share
  • Facebook
  • Report

Leave an answer
Cancel reply

You must login to add an answer.

Forgot Password?

Need An Account, Sign Up Here

1 Answer

  • Voted
  • Oldest
  • Recent
  • Random
  1. Editorial Team
    Editorial Team
    2026-05-22T18:34:59+00:00Added an answer on May 22, 2026 at 6:34 pm

    The error you get means the SMTP server you’re talking to doesn’t claim to support authentication. If you look at the debug output you’ll see that none of the responses to your EHLOs contain the necessary declaration for AUTH. If it did (properly) support authentication, one of the responses would be something like:

    250 AUTH GSSAPI DIGEST-MD5 PLAIN
    

    (at least in reponse to the EHLO after the STARTTLS.) Because that response isn’t included, smtplib assumes the server won’t be able to handle the AUTH command, and will refuse to send it. If you’re certain your SMTP server does support the AUTH command even though it doesn’t advertise it, you can sneakily convince smtplib that it supports AUTH by explicitly adding it to the set of features. You’ll need to know which kind of authentication schemes are supported, and then you can do:

    smtp.starttls()
    smtp.ehlo()
    # Pretend the SMTP server supports some forms of authentication.
    smtp.esmtp_features['auth'] = 'LOGIN DIGEST-MD5 PLAIN'
    

    … but of course making the SMTP server behave according to spec would be a better idea 🙂

    • 0
    • Reply
    • Share
      Share
      • Share on Facebook
      • Share on Twitter
      • Share on LinkedIn
      • Share on WhatsApp
      • Report

Sidebar

Related Questions

I'm trying to write a simple mail server using Python. I found smtpd that
I'm trying to write a simple python web application using the Tornado web server
I am trying to write a simple tool using Shoes. This will indent code
I'm trying to write a simple Python script that inserts .odt documents into an
I am trying to write a simple custom button in wx.Python. My code is
I'm trying to write a simple Python script for my mobile phone to periodically
I'm trying to write a very simple email script in python. It's basically a
I am trying to write a VERY simple UI in Python using Tkinter. I
I am trying to write simple Visual Studio Add-In for code generation. In my
I'm trying to write simple proxy server for some purpose. In it I use

Explore

  • Home
  • Add group
  • Groups page
  • Communities
  • Questions
    • New Questions
    • Trending Questions
    • Must read Questions
    • Hot Questions
  • Polls
  • Tags
  • Badges
  • Users
  • Help
  • SEARCH

Footer

© 2021 The Archive Base. All Rights Reserved
With Love by The Archive Base

Insert/edit link

Enter the destination URL

Or link to existing content

    No search term specified. Showing recent items. Search or use up and down arrow keys to select an item.