I am working on designing a Hook that monitors PBS resources. I am looking forward to implement email functionality wherein my Hook could send email to the users if their resources requested or used criteria is not met.
I had tried multiple ways to implement email feature in Hook through SMTP process but its not working out. Is there any other way?
Please let us know in which hook event you tried this ? Also, if you can share the hook with the community ( if it can be shared ) .
Please check whether you are able to send a mail via python script from the PBS Server host and PBS Compute nodes without using/calling it in a PBS hook.
Then you can call that script in runjob hook or server periodic hook or exechost_periodic hook by passing the required values.
When it writes an email has been triggered to the system admin there I need to implement email logic
Answer to your queries:
Yes I am able to send mail by using the below script through server
/usr/sbin/sendmail youremail@example.com
Subject: Test Send Mail
Hello World
control d (this key combination of control key and d will finish the email.)
I had tried using Python as well bu the below is not working out
import smtplib
server = smtplib.SMTP(âsmtp.gmail.comâ, 587)
#Next, log in to the server
server.login(âyouremailusernameâ, âpasswordâ)
#Send the mail
msg = "
Hello!" # The /n separates the message from the headers
server.sendmail("you@gmail.com", "target@example.com", msg)