troubleshooting Question

Python example mail

Avatar of fabiogaravelli
fabiogaravelli asked on
3 Comments2 Solutions466 ViewsLast Modified:
Hi experts,
i have this situation on my server, crontab runs in cron.daily and check the last revision on subversion server,make backup ,gzip the last revision and so on , at the it make rsync on storage server.I need to send mail to some user with the result of the operation.I need that define the user on a file in this way,user2@servertwo.two and so on. and the subject define on file in the same way on user ...
in this way , i can change the user list when i want , and the subject i populate it with result of crontab operation.
this is my script ..
#!/usr/bin/env python
import os
MAIL = "/usr/sbin/sendmail"
# get the email message from a file
f = open('mail.txt', 'r')
mssg =
# open a pipe to the mail program and
# write the data to the pipe
p = os.popen("%s -t" % MAIL, 'w')
exitcode = p.close()
if exitcode:
    print "Exit code: %s" % exitcode
i need ti changed it and have a list of the receipient on a file , and the text messagge on another..
Software Engineer

Our community of experts have been thoroughly vetted for their expertise and industry experience.

Join our community to see this answer!
Unlock 2 Answers and 3 Comments.
Start Free Trial
Learn from the best

Network and collaborate with thousands of CTOs, CISOs, and IT Pros rooting for you and your success.

Andrew Hancock - VMware vExpert
See if this solution works for you by signing up for a 7 day free trial.
Unlock 2 Answers and 3 Comments.
Try for 7 days

”The time we save is the biggest benefit of E-E to our team. What could take multiple guys 2 hours or more each to find is accessed in around 15 minutes on Experts Exchange.

-Mike Kapnisakis, Warner Bros