← ↑ | Python例 (メール配送) | → |
# mailer module mailer.py import posix # make posix system calls available def mailit(filename, subject, list): # mail the file to each victim for victim in list: # make a shell mail command for this victim string = 'cat ' + filename + \ ' | mail -n -s ' + `subject` + ' ' + victim print string # echo the command posix.system(string) # execute the command usage = 'function: mailit(filename, subjectstring, list)'