本文整理匯總了Golang中github.com/jordwest/imap-server/mailstore.Message.Header方法的典型用法代碼示例。如果您正苦於以下問題:Golang Message.Header方法的具體用法?Golang Message.Header怎麽用?Golang Message.Header使用的例子?那麽, 這裏精選的方法代碼示例或許可以為您提供幫助。您也可以進一步了解該方法所在類github.com/jordwest/imap-server/mailstore.Message
的用法示例。
在下文中一共展示了Message.Header方法的3個代碼示例,這些例子默認根據受歡迎程度排序。您可以為喜歡或者感覺有用的代碼點讚,您的評價將有助於係統推薦出更棒的Golang代碼示例。
示例1: fetchHeaderSpecificFields
func fetchHeaderSpecificFields(args []string, c *Conn, m mailstore.Message, peekOnly bool) string {
if !peekOnly {
fmt.Printf("TODO: Peek not requested, mark all as non-recent\n")
}
fields := strings.Split(args[1], " ")
hdrs := m.Header()
requestedHeaders := make(textproto.MIMEHeader)
replyFieldList := make([]string, len(fields))
for i, key := range fields {
replyFieldList[i] = "\"" + key + "\""
// If the key exists in the headers, copy it over
v := hdrs.Get(key)
if v != "" {
requestedHeaders.Add(key, v)
}
}
hdr := util.MIMEHeaderToString(requestedHeaders)
hdrLen := len(hdr)
return fmt.Sprintf("BODY[HEADER.FIELDS (%s)] {%d}\r\n%s",
strings.Join(replyFieldList, " "),
hdrLen,
hdr)
}
示例2: fetchFullText
func fetchFullText(args []string, c *Conn, m mailstore.Message, peekOnly bool) string {
mail := fmt.Sprintf("%s\r\n%s\r\n", util.MIMEHeaderToString(m.Header()), m.Body())
mailLen := len(mail)
return fmt.Sprintf("BODY[] {%d}\r\n%s",
mailLen, mail)
}
示例3: fetchHeaders
func fetchHeaders(args []string, c *Conn, m mailstore.Message, peekOnly bool) string {
hdr := fmt.Sprintf("%s\r\n", util.MIMEHeaderToString(m.Header()))
hdrLen := len(hdr)
peekStr := ""
if peekOnly {
peekStr = ".PEEK"
}
return fmt.Sprintf("BODY%s[HEADER] {%d}\r\n%s", peekStr, hdrLen, hdr)
}