$from ...
[apps/madmutt.git] / alias.cpkg
index 2efa1ef..c4e739e 100644 (file)
@@ -88,6 +88,21 @@ rx_t *SubscribedLists = NULL, *UnSubscribedLists = NULL;
      */
     path_t record = NULL;
 
+    /*
+     ** .pp
+     ** This variable contains a default from address.  It
+     ** can be overridden using my_hdr (including from send-hooks) and
+     ** ``$$reverse_name''.  This variable is ignored if ``$$use_from''
+     ** is unset.
+     ** .pp
+     ** E.g. you can use
+     ** \fTsend-hook Madmutt-devel@lists.berlios.de 'my_hdr From: Foo Bar <foo@bar.fb>'\fP
+     ** when replying to the Madmutt developer's mailing list and Madmutt takes this email address.
+     ** .pp
+     ** Defaults to the contents of the environment variable \fT$$$EMAIL\fP.
+     */
+    address_t from = rfc822_parse_adrlist(NULL, NONULL(getenv("EMAIL")));
+
     void alternates(rx_t rx) {
         rx_list_remove(&UnAlternates, rx);
         rx_list_add(&Alternates, rx);
@@ -196,7 +211,7 @@ int mutt_addr_is_user(address_t *addr)
     ||  string_is_address(addr->mailbox, MCore.username, MCore.shorthost)
     ||  string_is_address(addr->mailbox, MCore.username, mutt_fqdn(0))
     ||  string_is_address(addr->mailbox, MCore.username, mutt_fqdn(1))
-    ||  (From && !ascii_strcasecmp(From->mailbox, addr->mailbox)))
+    ||  (MAlias.from && !ascii_strcasecmp(MAlias.from->mailbox, addr->mailbox)))
     {
         return 1;
     }