Forum
Welcome, Guest
Username: Password: Remember me
  • Page:
  • 1

TOPIC:

No new topic possible 1 year 2 months ago #1895

  • fow0ryl
  • fow0ryl's Avatar Topic Author
  • Offline
  • Posts: 13
Hello,
tried to open a new topic "mail alert problems". But this is not possible since all I tried is rejected as spam.
Looks like some "SMTP_" Keywords are rejected, even in a "code" block

Henning
[23:17 XCP-222 ssmtp]# ha-cfg get
MAIL_FROM=admin@MYDOMAIN.de
MAIL_ON=1
MAIL_SUBJECT="SYSTEM_ALERT-FROM_HOST:$HOSTNAME"
MAIL_TO=henning@MYDOMAIN.de
SMTP_PASS=****************
SMTP_PORT=465
SMTP_SERVER=smtp.MYISP.de
SMTP_USER=admin@MYDOMAIN.de
[19:33 XCP-222 ssmtp]# ha-cfg email_debug
Sending email from: admin@MYDOMAIN.de
Sending email to: henning@MYDOMAIN.de
Email Alert Subject: SYSTEM_ALERT-FROM_HOST:XCP-222
Email Alert Timestamp: Thu Sep 19 19:48:02 CEST 2019
Email Alert Process: ha-lizard Version: 2.2.1
Email Alert Message Content: Test Message ID 5777e8fd-e9ea-4417-9a3f-dd03af91d24f
Email Alert Message Hostname: XCP-222
Traceback (most recent call last):
  File "/etc/ha-lizard/scripts/email_alert.py", line 105, in <module>
    message = smtplib.SMTP(smtp_server, smtp_port, hostname)
  File "/usr/lib64/python2.7/smtplib.py", line 255, in __init__
    (code, msg) = self.connect(host, port)
  File "/usr/lib64/python2.7/smtplib.py", line 316, in connect
    (code, msg) = self.getreply()
  File "/usr/lib64/python2.7/smtplib.py", line 364, in getreply
    + str(e))
smtplib.SMTPServerDisconnected: Connection unexpectedly closed: timed out

code][19:49 XCP-222 ssmtp]# cat /etc/ssmtp/ssmtp.conf
root=admin@MYDOMAIN.de
mailhub=smtp.MYISP.de:465
RewriteDomain=MYDOMAIN.de
Hostname=MYDOMAIN.de
FromLineOverride=NO
UseTLS=YES
AuthUser=admin@MYDOMAIN.de
AuthPass=****************[/code]

Please Log in or Create an account to join the conversation.

Last edit: by fow0ryl.

No new topic possible 1 year 2 months ago #1897

  • fow0ryl
  • fow0ryl's Avatar Topic Author
  • Offline
  • Posts: 13
Hello,

I have tried to edit my first entry of this thread, to check what line may be the problem.
First it seems to work.
I added first code block. ok
I added second code block ok
I added third code block ok
But I forgot the initial "[" at the beginning of the last code block, and want to add it.

And now I'm unable to add the "[" or remove the complete last block, because it is detected as spam ...

Henning

Please Log in or Create an account to join the conversation.

No new topic possible 3 weeks 2 days ago #2243

This exception is raised when the server unexpectedly disconnects, or when an attempt is made to use the python mail SMTP instance before connecting it to a server. Clients sending outgoing mail should connect on port 587 and use starttls. To use port 465, you need to call smtplib.SMTP_SSL(). Currently, it calls smtplib.SMTP() .. so,change your PORT from 465 into 587 it. Also, you'll need to send the ehlo command before the starttls command, then again after the starttls command.

Please Log in or Create an account to join the conversation.

No new topic possible 1 week 3 days ago #2259

  • Salvatore Costantino
  • Salvatore Costantino's Avatar
  • Offline
  • Posts: 653
We will take a look at this.

Please Log in or Create an account to join the conversation.

No new topic possible 1 week 3 days ago #2260

  • Salvatore Costantino
  • Salvatore Costantino's Avatar
  • Offline
  • Posts: 653
Below snippet is from our latest stable release (about a year ago). We are already handling SSL on port 465.
if smtp_port == "465":
        message = smtplib.SMTP_SSL(smtp_server, smtp_port, hostname)
else:
        message = smtplib.SMTP(smtp_server, smtp_port, hostname)
message.set_debuglevel(9)
if len(sys.argv[9]) > 1:
        message.login(smtp_user, smtp_pass)
message.sendmail(from_email, to_email, msg.as_string())

Please Log in or Create an account to join the conversation.

  • Page:
  • 1