English Forums > Tutorials and FAQs

Script to send emails for updates

<< < (3/7) > >>

TheLatestWire:
I'm using this script on another deployment of OPNsense in an environment where I only have an OpenBSD server to use for the SMTP service of this script and I'm not able to send the script's email using that server.  I get this error:

Traceback (most recent call last):
  File "fw_update-1.1.py", line 58, in <module>
    s.sendmail(sender,recipients,message)
  File "/usr/local/lib/python2.7/smtplib.py", line 746, in sendmail
    raise SMTPDataError(code, resp)
smtplib.SMTPDataError: (550, '5.7.1 Delivery not authorized, message refused: Message is not RFC 2822 compliant')

Is anyone able to use an OpenBSD mail server to deliver this script without this error by chance?

This is what it looks like from the OpenBSD smtp server side:

<<< [MSG] <br>Click <a href="https://192.168.2.1/ui/core/firmware/">here</a> to fetch them.<br>
debug: 0x18f9f6123000: end of message, msgflags=0x8000
smtp: 0x18f9f6123000: >>> 550 5.7.1 Delivery not authorized, message refused: Message is not RFC 2822 compliant
smtp-in: Failed command on session 48cc59eadf55d2f9: "data" => 550 5.7.1 Delivery not authorized, message refused: Message is not RFC 2822 compliant
smtp: 0x18f9f6123000: STATE_BODY -> STATE_HELO
smtp: 0x18f9f6123000: <<< rset
smtp: 0x18f9f6123000: >>> 250 2.0.0: Reset state
smtp-in: Received disconnect from session 48cc59eadf55d2f9
debug: smtp: 0x18f9f6123000: deleting session: disconnecte

Thanks.

bartjsmit:
Most likely cause for a 5.7.1 error is that your FreeBSD MTA denies relay from your firewall.

Can you get a message to the recipient manually through a telnet session on port 25?

Bart...

TheLatestWire:
I'm able to send a test email using this python script from the OPNsense server via the same OpenBSD mail server that is returning the "not RFC 2822 compliant" message for the fw_update-1.1.py script.

#!/usr/bin/python
import smtplib
sender = 'myname@mydomain'
receivers = ['myname@mydomain]
message = """From: From OPNsense <myname@mydomain>
To: To Person <myname@mydomain>
Subject: SMTP e-mail test
This is a test e-mail message.
"""
try:
   smtpObj = smtplib.SMTP('192.168.2.2')
   smtpObj.sendmail(sender, receivers, message)
   print "Successfully sent email"
   except SMTPException:
   print "Error: unable to send email"


Thanks.

franco:
Well, what is the IMF output of the script? I guess the error is pretty clear, just need to figure out what is wrong with the message that should be dispatched.

TheLatestWire:
Sorry for the stupid question, but what is IMF?  I'm just coming up with "International Monetary Fund" but I'm sure that's not what you mean.  ;)

Navigation

[0] Message Index

[#] Next page

[*] Previous page

Go to full version