Improve the algorithm of obtaining sender name from messages.
* include/mailutils/header.h: Remove unnecessary externs. (mu_url_sget_param, mu_url_aget_param): New protos. * libmailutils/base/url.c (mu_url_sget_param, mu_url_aget_param): New functions. * libmailutils/mailbox/hdrfirst.c: New file. * libmailutils/mailbox/Makefile.am (libmailbox_la_SOURCES): Add hdrfirst.c. * libmailutils/mailbox/message.c (message_envelope_sender): Try to restore the envelope sender from X-Envelope-Sender, X-Envelope-From, X-Original-Sender, and From headers, in that order. * libmailutils/mailer/mailer.c (_set_from): Try to obtain sender from the message envelope. If that fails, fall back to the From header. * libproto/mailer/mbox.c (parse_received, guess_message_recipient): New static functions. (remote_mbox_append_message): Get recipient address from the first of X-Envelope-To, Delivered-To, X-Original-To headers, in that order. If that fails, try to deduce it from the Received header. If that fails too, fall back to the To header. If recipient-headers URL parameter is defined, its value (a comma-separated list of names) overrides this list. The strip-domain parameter, if present, instructs the function to strip domain part from the recipient address before resolving it. The domain parameter, if present, supplies the domain name which overrides the domain obtained from the URL.
Showing
8 changed files
with
389 additions
and
103 deletions
libmailutils/mailbox/hdrfirst.c
0 → 100644
-
Please register or sign in to post a comment