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 = '[email protected]'
11 receivers = '[email protected]'
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('[email protected]')
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()