only warn if MX mail host was not found, dont give an error because mail could still be sent, even with no MX DNS entry

git-svn-id: https://linkchecker.svn.sourceforge.net/svnroot/linkchecker/trunk/linkchecker@376 e7d03fd6-7b0d-0410-9947-9c21f3af8025
This commit is contained in:
calvin 2002-02-26 21:21:20 +00:00
parent c6e1a269bf
commit e66b5b80ca
2 changed files with 10 additions and 7 deletions

View file

@ -35,18 +35,21 @@ class MailtoUrlData(HostCheckingUrlData):
HostCheckingUrlData.buildUrl(self)
self.headers = {}
self.adresses = AddressList(self._cutout_adresses()).addresslist
for key in ("to","cc","bcc"):
for key in ("to", "cc", "bcc"):
if self.headers.has_key(key):
for val in self.headers[key]:
a = urllib.unquote(val)
self.adresses.extend(AddressList(a).addresslist)
Config.debug(BRING_IT_ON, "mailto headers:", self.headers)
Config.debug(BRING_IT_ON, "adresses: ", self.adresses)
def _cutout_adresses(self):
mo = headers_re.search(self.urlName)
if mo:
self.headers = cgi.parse_qs(mo.group(1), strict_parsing=1)
headers = cgi.parse_qs(mo.group(1), strict_parsing=1)
for key, val in headers.items():
key = key.lower()
self.headers.setdefault(key, []).extend(val)
return self.urlName[7:mo.start()]
return self.urlName[7:]
@ -76,7 +79,7 @@ class MailtoUrlData(HostCheckingUrlData):
mxrecords = DNS.mxlookup(host, protocol="tcp")
Config.debug(HURT_ME_PLENTY, "found mailhosts", mxrecords)
if not len(mxrecords):
self.setError(linkcheck._("No mail host for %s found")%host)
self.setWarning(linkcheck._("No MX mail host for %s found")%host)
return
smtpconnect = 0
for mxrecord in mxrecords:
@ -96,12 +99,12 @@ class MailtoUrlData(HostCheckingUrlData):
if smtpconnect: break
if not smtpconnect:
self.setWarning(linkcheck._("None of the mail hosts for %s accepts an "
self.setWarning(linkcheck._("None of the MX mail hosts for %s accepts an "
"SMTP connection: %s") % (host, str(value)))
mxrecord = mxrecords[0][1]
else:
mxrecord = mxrecord[1]
self.setValid(linkcheck._("found mail host %s") % mxrecord)
self.setValid(linkcheck._("found MX mail host %s") % mxrecord)
def _split_adress(self, adress):

View file

@ -8,7 +8,7 @@
<a href="mailto:Bastian Kleineidam <calvin@studcs.uni-sb.de>">4</a>
<a href="mailto:">6</a>
<a href="mailto:o'hara@cs.uni-sb.de">5</a>
<a href="mailto:?to=calvin@studcs.uni-sb.de?subject=blubb">...</a>
<a href="mailto:?to=calvin@studcs.uni-sb.de&subject=blubb&cc=calvin_cc@studcs.uni-sb.de&CC=calvin_CC@studcs.uni-sb.de">...</a>
<a href="mailto:news-admins@freshmeat.net?subject=Re:%20[fm%20#11093]%20(news-admins)%20Submission%20report%20-%20Pretty%20CoLoRs">...</a>
<a href="mailto:jan@jan-dittberner.de?subject=test">...</a>
<!-- illegal -->