当前位置:网站首页>ABAQUS script email auto notification

ABAQUS script email auto notification

2022-04-23 20:20:00 Install a sound 77

Using abaqus Carry out large-scale model calculation , Depending on the mesh , Time can be half an hour and 1 Different days .

In particular, batch calculations involving cycles , It is impossible to estimate the length of time . So while using the script, it involves a mailbox automatic notification function at the end

When the post-processing is completed, you can automatically notify qq mailbox .

because abaqus It uses python2 Language , and python3 There are some differences in details .

The mailbox database is self-contained , Respectively

smtplib  and  email  All are py2 Native library 

In use at the same time QQ You need to open the authentication in your account when you email , Mobile phone verification is required , This tutorial is described in other articles , Again, I won't explain in detail , This step must not be reduced .

import smtplib
from email.mime.text import MIMEText

msg_from = '[email protected]'## Own account 
passwd = 'XXXX'# Authorization code obtained after verification 
msg_to = '[email protected]'### Account number sent 

subject = " notice "  #
content = "abaqus Batch calculation completed "
msg = MIMEText(content)
msg['Subject'] = subject
msg['From'] = msg_from
msg['To'] = msg_to
try:
    s = smtplib.SMTP_SSL("smtp.qq.com", 465)
    s.login(msg_from, passwd)
    s.sendmail(msg_from, msg_to, msg.as_string())
    print " Send successfully "
except:
    print " fail in send "
finally:
    s.quit()

The upper code can be placed in abaqus In the script of

 

 

版权声明
本文为[Install a sound 77]所创,转载请带上原文链接,感谢
https://yzsam.com/2022/04/202204210551491571.html