資源簡介
Apache中的一個郵件服務器

代碼片段和文件信息
#!/usr/bin/python
#
#????Licensed?to?the?Apache?Software?Foundation?(ASF)?under?one
#????or?more?contributor?license?agreements.??See?the?NOTICE?file
#????distributed?with?this?work?for?additional?information
#????regarding?copyright?ownership.??The?ASF?licenses?this?file
#????to?you?under?the?Apache?License?Version?2.0?(the
#????“License“);?you?may?not?use?this?file?except?in?compliance
#????with?the?License.??You?may?obtain?a?copy?of?the?License?at
#
#??????http://www.apache.org/licenses/LICENSE-2.0
#
#????Unless?required?by?applicable?law?or?agreed?to?in?writing
#????software?distributed?under?the?License?is?distributed?on?an
#????“AS?IS“?BASIS?WITHOUT?WARRANTIES?OR?CONDITIONS?OF?ANY
#????KIND?either?express?or?implied.??See?the?License?for?the
#????specific?language?governing?permissions?and?limitations
#????under?the?License.????
#
#?--------------------------------------------------------------------------
#
#?This?is?a?simple?mail?client?intended?to?suffice?as?the?required
#?“sendmail“?client?on?typical?UNIX-style?systems.??It?requires?an
#?SMTP?SMTP?server?for?handling?the?e-mail?that?users?and?system
#?utilities?may?send?via?“sendmail“.
#
#?To?install?symlink?from?/usr/{[s]binlib[exec]}/sendmail?or?similar
#?for?the?particular?deployment.
#
#?--------------------------------------------------------------------------
import?smtplib
import?socket
import?os
import?sys
import?getopt
def?Usage():
????print?“sendmail?[-f?][-F?][-t][-h]“
????sys.exit(0)
def?ProcessHeaders(headers?to_addrs?extract?fullname?from_addr):
????hasFrom?=?False
????for?header?in?headers:
????????if?header.startswith(“To:“):
????????????if?extract:
????????????????#to?=?header[3:]
????????????????#to_addrs.append(to[(“<“?+?to).rfind(“<“):(to?+?“>“).find(“>“)])
????????????????allRecipientsString?=?header[3:]
????????????????allRecipientsArray?=?allRecipientsString.split(‘‘)
????????????????
????????????????for?recipient?in?allRecipientsArray:
??????????????????to_addrs.append(recipient[(“<“?+?recipient).rfind(“<“):(recipient?+?“>“).find(“>“)])
????????elif?header.startswith(“From:“):
????????????hasFrom?=?True
???????????
????if?hasFrom:
????????header?=?“Sender“
????else:
????????header?=?“From“
????if?fullname:
????????headers.insert(0?“%s:?%s?<%s>“?%?(headerfullname?from_addr))
????else:
????????headers.insert(0?“%s:?%s“?%?(header?from_addr))
????return?headers?to_addrs
def?main(argv):
????try:
????????optlist?list?=?getopt.getopt(sys.argv[1:]?‘f:F:hti‘)
????except?getopt.GetoptError:
????????Usage()
????????print?>>?sys.stderr?“called?exception“
????????sys.exit(2)
????to_addrs?=?list
????
????try:
????????from_addr?=?os.environ[‘USER‘]?+?‘@‘?+?socket.getfqdn()
????except?KeyError:
????????from_addr?=?“nobody@“?+?socket.getfqdn()
????????
????????
????fullname?=?““
????extract?=?False
????for?opt?value?in?optlist:
????????if?opt?==?‘-h‘:
????????????Usage()
????????elif?opt?==?‘-t‘:
????????????extract?=?Tru
?屬性????????????大小?????日期????時間???名稱
-----------?---------??----------?-----??----
?????文件?????????27??2007-04-25?16:00??james-2.3.1\apps\dummy.txt
?????文件????4176598??2007-04-25?16:00??james-2.3.1\apps\james.sar
?????文件????????140??2007-04-25?16:00??james-2.3.1\bin\derby.properties
?????文件??????25274??2007-04-25?16:00??james-2.3.1\bin\lib\excalibur-cli-1.0.jar
?????文件??????53985??2007-04-25?16:00??james-2.3.1\bin\lib\excalibur-extension-1.0a.jar
?????文件?????118334??2007-04-25?16:00??james-2.3.1\bin\lib\excalibur-instrument-manager-1.0.jar
?????文件??????41533??2007-04-25?16:00??james-2.3.1\bin\lib\excalibur-io-1.1.jar
?????文件??????89145??2007-04-25?16:00??james-2.3.1\bin\lib\excalibur-logger-2.1.jar
?????文件??????32412??2007-04-25?16:00??james-2.3.1\bin\lib\excalibur-monitor-2.1.jar
?????文件??????65261??2007-04-25?16:00??james-2.3.1\bin\lib\jakarta-oro-2.0.8.jar
?????文件?????343900??2007-04-25?16:00??james-2.3.1\bin\lib\mx4j-jmx.jar
?????文件?????266911??2007-04-25?16:00??james-2.3.1\bin\lib\mx4j-tools.jar
?????文件???????2559??2007-04-25?16:00??james-2.3.1\bin\lib\mx4j.LICENSE
?????文件?????201996??2007-04-25?16:00??james-2.3.1\bin\lib\phoenix-engine.jar
?????文件??????29032??2007-04-25?16:00??james-2.3.1\bin\lib\spice-classman-1.0.jar
?????文件??????19255??2007-04-25?16:00??james-2.3.1\bin\lib\spice-loggerstore-0.5.jar
?????文件??????23761??2007-04-25?16:00??james-2.3.1\bin\lib\spice-salt-0.8.jar
?????文件??????20990??2007-04-25?16:00??james-2.3.1\bin\lib\spice-xm
?????文件???????2590??2007-04-25?16:00??james-2.3.1\bin\lib\spice.LICENSE
?????文件??????12599??2007-04-25?16:00??james-2.3.1\bin\phoenix-loader.jar
?????文件???????6930??2007-04-25?16:00??james-2.3.1\bin\phoenix.sh
?????文件???????2984??2007-04-25?16:00??james-2.3.1\bin\run.bat
?????文件????????854??2007-04-25?16:00??james-2.3.1\bin\run.sh
?????文件???????3878??2007-04-25?16:00??james-2.3.1\bin\sendmail.py
?????文件??????69632??2007-04-25?16:00??james-2.3.1\bin\Wrapper.dll
?????文件?????167936??2007-04-25?16:00??james-2.3.1\bin\Wrapper.exe
?????文件??????82258??2007-04-25?16:00??james-2.3.1\bin\wrapper.jar
?????文件???????1863??2007-04-25?16:00??james-2.3.1\bin\Wrapper.LICENSE
?????文件??????11071??2007-04-25?16:00??james-2.3.1\conf\kernel.xm
?????文件???????1042??2007-04-25?16:00??james-2.3.1\conf\phoenix-service.xm
............此處省略61個文件信息
- 上一篇:2017年美國數學建模大賽題目
- 下一篇:HANVONSDK20141119.rar
評論
共有 條評論