Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Impossible to send email notification #71

Closed
Romu007 opened this issue Apr 21, 2018 · 8 comments
Closed

Impossible to send email notification #71

Romu007 opened this issue Apr 21, 2018 · 8 comments

Comments

@Romu007
Copy link

Romu007 commented Apr 21, 2018

Hello all,

i recently downloaded your script to backup my VMs and thanks a lot for your work.

But when I'm trying to configure the mail notification, i have this error at the end of the script :

Exception: socket.error - (97, 'Address family not supported by protocol')

Do you have any idea please ?

Thanks a lot for your help
Romu

@Romu007
Copy link
Author

Romu007 commented Apr 21, 2018

le output log :

Exception: socket.error - (97, 'Address family not supported by protocol')
Exception: socket.error - (97, 'Address family not supported by protocol')
^C
2018-04-21-(11:00:27) - ***ERROR EXCEPTION - exceptions.KeyboardInterrupt
2018-04-21-(11:00:27) - ***ERROR NOTE: see VmBackup output for details
Traceback (most recent call last):
File "/home/XenServer-SDK/XenServerPython/backup_test.py", line 1495, in ?
main(session)
File "/home/XenServer-SDK/XenServerPython/backup_test.py", line 490, in main
send_email(MAIL_TO_ADDR,'WARNING VmBackup.py', status_log)
File "/home/XenServer-SDK/XenServerPython/backup_test.py", line 877, in send_email
s = smtplib.SMTP(MAIL_SMTP_SERVER)
File "/usr/lib/python2.4/smtplib.py", line 244, in init
(code, msg) = self.connect(host, port)
File "/usr/lib/python2.4/smtplib.py", line 297, in connect
self.sock.connect(sa)
File "", line 1, in connect
KeyboardInterrupt

@NAUbackup
Copy link
Owner

Hi, Romu... Did you look at the README file as to an example of how and where to define the SMPT mail server? What have you put in? Is that mail server even reachable from your XenServer host (you can try to telnet to port 25 of it as a test)?
Regards,
--Tobias

@VARGA-Peter
Copy link

Does this help you?

MCVE for email check

@Romu007
Copy link
Author

Romu007 commented Apr 23, 2018

Hello guys,

it seems that i can't use SSL with the version of my python

python

Python 2.4.3 (#1, Sep 21 2011, 20:06:00)
[GCC 4.1.2 20080704 (Red Hat 4.1.2-51)] on linux2

i have to update the python's version .

Do you have any other idea ?

Also, Albundy, i have an error when i'm trying to send with your link :

python testmailromu.py
Traceback (most recent call last):
File "testmailromu.py", line 94, in ?
send_email('[email protected]', 'Test-Email VmBackup.py', status_log)
File "testmailromu.py", line 90, in send_email
print("Exception: SMTPException - %s" %e.message)
AttributeError: SMTPServerDisconnected instance has no attribute 'message'

@NAUbackup
Copy link
Owner

NAUbackup commented Apr 23, 2018

There should be a much newer version on your XenServer -- 2.7.5 on XS 7.X which runs the Linux kernel 4.4.0. What version of XenServer is this? Before early version of XS 6.X, this script is not going to work as it requires a reasonable new version of python to run, so your suspicion is probably correct.

@VARGA-Peter
Copy link

VARGA-Peter commented Apr 23, 2018

Look Romu007,

I am not a Python programmer. I extracted the test script from the existing VmBackup.py in order I can find out very convenient the correct SMTP settings for my Exchange server and test, if it does accept the relay.

Now, it is your task to play around and sort everything out. The script works and when you get errors you have to comment/uncomment/edit the 4 lines until you receive an email. Sorry, I can't do more for you.

@NAUbackup
Copy link
Owner

There is a section in the code that explains how to do the modifications for making it possible to do TLS connections. Note that Exchange is a beast when it comes to using it to relay email and that -- as Peter says above -- is well beyond the scope of the forum and applies to any utility that needs to be customized to connect to an email server, no matter what kind of email server it is. This is a local configuration issue. It took me a long time, for example, just to figure out how to get the Thunderbird email client to work with exchange, and this is really no different.
Finally, very old version of XenServer will likely not work because python is to old and those older version of XenServer will not be supported. Early XS 6.X versions are already end-of-lifed.

--Tobias

@NAUbackup
Copy link
Owner

I am closing this thread.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

3 participants