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

  • Home
  • SEARCH
  • 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 3243684
In Process

The Archive Base Latest Questions

Editorial Team
  • 0
Editorial Team
Asked: May 17, 20262026-05-17T18:27:44+00:00 2026-05-17T18:27:44+00:00

I’ve writted a Python script to send emails via a relay server. I’ve tested

  • 0

I’ve writted a Python script to send emails via a relay server. I’ve tested that the appropriate email address’s etc are permissioned etc by sending an email using Telnet. My Python script also work when set up to send via my old relay server.

Therefore i am confused as to why i am getting the following error message:

 (552, '5.6.0 Submission denied Sender does not match originator <myEmailAddress>)

I’ve looked at the SMTP error 552 and it is caused by the message size being exceeded, but i am only sending an email containing a few lines of html which is only a few kb in size so i’m assuming i can safely rule this issue out.

Any other ideas as to what could be the issue?

EDIT:
Here is the Python code which generates the error.

1 #!/usr/bin/env python
  2 import sys
  3 from sys import argv
  4 import smtplib
  5 import logging
  6 import logging.handlers
  7
  8 LOG_FILENAME = 'sendMail.log'
  9 inputMessage = argv[1]
 10 sender = 'hi@sender.com'
 11 receivers = 'hi@sender.com'
 12 #Reads in the file as a single string
 13 message = open(inputMessage, 'r').read()
 14 log = logging.getLogger()
 15
 16 def initializelogging():
 17     log.setLevel(logging.DEBUG)
 18     fileformatter = logging.Formatter('%(asctime)s %(levelname)s %(message)s')
 19     filehandler = logging.handlers.RotatingFileHandler(
 20                   LOG_FILENAME,
 21                   maxBytes=10000000,
 22                   backupCount=100)
 23     filehandler.setFormatter(fileformatter)
 24     consoleformatter = logging.Formatter('%(levelname)s: %(message)s')
 25     consolehandler = logging.StreamHandler()
 26     consolehandler.setLevel(logging.INFO)
 27     consolehandler.setFormatter(consoleformatter)
 28     log.addHandler(filehandler)
 29     log.addHandler(consolehandler)
 30 initializelogging()
 31
 32 def sendMail():
 33     try:
 34        
 35         smtpObj = smtplib.SMTP('mailserver@server.com')
 36         smtpObj.sendmail(sender,sender, message)
 37         print "Successfully sent email"
 38         log.info('Successfully sent email')
 39     except Exception, err:
 40         log.error('Unable to send email. See below stack trace........')
 41         log.error('%s\n' % str(err))
 42 sendMail()
  • 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-17T18:27:45+00:00Added an answer on May 17, 2026 at 6:27 pm

    I can’t guarantee that either of these is the actual cause of the error, but:

    1. I think the message you’re getting might be saying that the From: header in your message doesn’t match the e-mail address you are using for the sender in the sendmail() call. Make sure that the message you are reading from the file a) has valid SMTP headers (at least From, To, and Subject, and MIME-Version and Content-Type wouldn’t hurt) and more specifically b) has a From: hi@sender.com header.

    2. The instantiation for a SMTP object takes a server address, not an e-mail address. You should be using smtpObj = smtplib.SMTP('mail.server.com') or something else without so much @ in it. Otherwise, it may not be connecting to the server you think it is.

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

Sidebar

Related Questions

No related questions found

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.