當前位置: 首頁>>代碼示例>>Golang>>正文


Golang Mail.Name方法代碼示例

本文整理匯總了Golang中mailfile.Mail.Name方法的典型用法代碼示例。如果您正苦於以下問題:Golang Mail.Name方法的具體用法?Golang Mail.Name怎麽用?Golang Mail.Name使用的例子?那麽, 這裏精選的方法代碼示例或許可以為您提供幫助。您也可以進一步了解該方法所在mailfile.Mail的用法示例。


在下文中一共展示了Mail.Name方法的7個代碼示例,這些例子默認根據受歡迎程度排序。您可以為喜歡或者感覺有用的代碼點讚,您的評價將有助於係統推薦出更棒的Golang代碼示例。

示例1: Filter

func (spmf *SubjectPrefixMatchFilter) Filter(mail mailfile.Mail) Result {
	log.Printf("Run %s, Mail:%s\n", spmf, mail.Name())
	spmf.total.Inc(1)

	matched := false
	for _, subjectPrefix := range spmf.subjectPrefixes {
		if strings.HasPrefix(mail.Subject(), subjectPrefix) {
			matched = true
			spmf.matched.Inc(1)
			break
		}
	}

	if !matched {
		return Incoming
	}

	return spmf.next.Filter(mail)
}
開發者ID:postfix,項目名稱:spamdefender,代碼行數:19,代碼來源:subjectprefixmatchfilter.go

示例2: Filter

func (sof *RelayOnlyFilter) Filter(mail mailfile.Mail) Result {
	log.Printf("Run %s, Mail:%s\n", sof, mail.Name())
	sof.total.Inc(1)

	sendOut := false
	for _, address := range mail.To() {
		if !strings.HasSuffix(address.Address, sof.localDomain) {
			sendOut = true
			sof.numOfRelay.Inc(1)
			break
		}
	}

	if !sendOut {
		return Incoming
	}

	return sof.next.Filter(mail)
}
開發者ID:postfix,項目名稱:spamdefender,代碼行數:19,代碼來源:relayonlyfilter.go

示例3: Filter

func (cif *ContentInspectionFilter) Filter(mail mailfile.Mail) Result {
	log.Printf("Run %s, Mail:%s\n", cif, mail.Name())
	cif.total.Inc(1)

	post, err := mailpost.Parse(mail)
	mail.Close()
	if err != nil {
		cif.malformed.Inc(1)
		log.Printf("ContentInspectionFilter: Err:%v, Mail:%s\n", err, mail.Path())
		return cif.next.Filter(mail)
	}

	class := cif.anlz.Test(post.Subject + " " + post.Content)
	cif.counters[class].Inc(1)
	if cif.allPass || analyzer.Good == class {
		return cif.next.Filter(mail)
	}

	return Quarantine
}
開發者ID:postfix,項目名稱:spamdefender,代碼行數:20,代碼來源:contentinspectionfilter.go

示例4: Filter

func (df *DeliverFilter) Filter(mail mailfile.Mail) Result {
	log.Printf("Run %s, Mail:%s\n", df, mail.Name())
	df.total.Inc(1)

	result := df.next.Filter(mail)

	df.counters[result].Inc(1)

	if result == None {
		log.Fatalf("DeliverFilter: the filter result should not be None, Mail:%s\n", mail.Name())
	}

	destination := filepath.Join(df.paths[result], mail.Name())
	log.Printf("Move to %s, Mail:%s\n", destination, mail.Name())

	err := os.Rename(mail.Path(), destination)
	if err != nil {
		log.Printf("DeliverFilter: Err:%v, Mail:%s\n", err, mail.Name())
	}

	return None
}
開發者ID:postfix,項目名稱:spamdefender,代碼行數:22,代碼來源:deliverfilter.go

示例5: Update

func (cih *ContentInspectionUpdater) Update(mail mailfile.Mail) {
	if leaner, ok := cih.anlz.(analyzer.Learner); ok {
		log.Printf("Run %s, Mail:%s\n", cih, mail.Name())
		cih.total.Inc(1)

		post, err := mailpost.Parse(mail)
		mail.Close()
		if err != nil {
			cih.malformed.Inc(1)
			log.Printf("ContentInspectionUpdater: Err:%v, Mail:%s\n", err, mail.Path())
			return
		}

		leaner.Learn(post.Subject, cih.class)
		leaner.Learn(post.Content, cih.class)

		err = os.Remove(mail.Path())
		if err != nil {
			log.Println(err)
		}
	}
}
開發者ID:postfix,項目名稱:spamdefender,代碼行數:22,代碼來源:contentinspectionupdater.go

示例6: Filter

func (cf *CachingProxy) Filter(mail mailfile.Mail) Result {
	log.Printf("Run %s, Mail:%s\n", cf, mail.Name())
	cf.total.Inc(1)

	keyer, ok := cf.target.(CacheKey)

	if !ok {
		log.Fatalf("%s should implement CacheKey interface\n", cf.target)
		return None
	}

	key := keyer.Key(mail)

	cf.rwm.RLock()
	for e := cf.l.Front(); e != nil; e = e.Next() {
		if t, ok := e.Value.(*CacheEntry); ok {
			if key == t.key {
				cf.rwm.RUnlock()
				cf.hit.Inc(1)
				return t.result
			}
		}
	}
	cf.rwm.RUnlock()

	result := cf.target.Filter(mail)

	cf.rwm.Lock()
	cf.l.PushFront(&CacheEntry{key, result})
	if cf.l.Len() > cf.size {
		cf.l.Remove(cf.l.Back())
	}
	cf.cached.Update(int64(cf.l.Len()))
	cf.rwm.Unlock()

	return result
}
開發者ID:postfix,項目名稱:spamdefender,代碼行數:37,代碼來源:cachingfilter.go

示例7: Filter

func (ddf *DefaultDestinationFilter) Filter(mail mailfile.Mail) Result {
	log.Printf("Run %s, Mail:%s\n", ddf, mail.Name())
	ddf.total.Inc(1)
	return Incoming
}
開發者ID:postfix,項目名稱:spamdefender,代碼行數:5,代碼來源:defaultdestinationfilter.go


注:本文中的mailfile.Mail.Name方法示例由純淨天空整理自Github/MSDocs等開源代碼及文檔管理平台,相關代碼片段篩選自各路編程大神貢獻的開源項目,源碼版權歸原作者所有,傳播和使用請參考對應項目的License;未經允許,請勿轉載。