Create
    ➜  ~ cat /opt/scripts/mail.py
    !/usr/bin/env python3
    import os
    import sys
    import smtplib
    import mimetypes
    from email.mime.multipart import MIMEMultipart
    from email.mime.base import MIMEBase
    from email.mime.text import MIMEText
    from email.mime.audio import MIMEAudio
    from email.mime.image import MIMEImage
    from email import encoders
    
    def sendMail(subject, text):
        gmailUser = 'pve@t.ch'
        gmailPassword = 'pa55Word'
        recipient = 'pve@t.ch'
    
         Create the container email message
        msg = MIMEMultipart()
        msg['From'] = gmailUser
        msg['To'] = recipient
        msg['Subject'] = subject
        msg.attach(MIMEText(text, 'plain'))
    
        try:
             Setup the SMTP server
            mailServer = smtplib.SMTP('xxxx.xxx', 1234)
            #mailServer.ehlo()
            #mailServer.starttls()
            #mailServer.ehlo()
            mailServer.login(gmailUser, gmailPassword)
    
             Send the email
            mailServer.sendmail(gmailUser, recipient, msg.as_string())
            mailServer.close()
    
            print('Sent email to %s' % recipient)
        except Exception as e:
            print('Failed to send email: %s' % str(e))
    
    if __name__ == "__main__":
        if len(sys.argv) != 3:
            print("Usage: send_mail.py <subject> <message>")
            sys.exit(1)
    
        subject = sys.argv[1]
        text = sys.argv[2]
        sendMail(subject, text)
联系方式

关于我

那年今日
17 月前

ipmitool -I lan -U ADMIN -H 10.0.0.4 sensor thresh FAN1 lower 150 225 300Replacing:ADMIN with the IPMI username10.0.0.4 with your own IPMI addressFAN1 with the desired FAN (FANA, FAN1, FAN2, FAN3, FAN4)150 with the lower non-recoverable value225 with the lower critical value300 with the lower non-critical value