Lumail - The console email client


Changing outgoing email-address

Although lumail doesn't have the notion of profiles it does allow you to tweak settings via various callback hooks.

The function on_folder_changed, documented in our API, is invoked every time a new folder is opened and can change your outgoing email address, or apply other tweaks.

Per-Folder Sender-Address

--
--  Change outgoing email-address if specific
-- folders are selected.
--
--  NOTE: We use lua regular expressions here
--
function on_folder_changed(fld)

   local path = fld:path()

   --
   -- Default to use if no match.
   --
   local def_mail = "<default@example.fi>"

   local from = {
      ['example.com'] = "<steve@example.com>",
      ['example.org'] = "<steve@example.org>",
      ['people%-']    = "<steve@example.fi>",
   }

   for pattern,email in pairs(from) do
      if ( string.find( path, pattern ) )then
         Config:set("global.sender", email )
         Panel:append("Changed outgoing email-address to " .. email )
         return
      end
   end

   -- No match - use the default.
   Config:set( "global.sender", def_mail )
end