Local::Email -- setup local email configuration


   use Local::Email; # sets environment variables for qmail-inject
   my $sender_address = Local::Email::get_my_address();
   my $recipients = Local::Email::get_addresses($login);
   Local::Email::send_email($login, "Hi $login", (
      "this is a short test message",
   my $root = Local::Email::get_rootaddress();


Local::Email allows to send and receive emails at a system where login names and the local domain name are no longer valid email addresses. This module, if loaded, sets up following environment variables in dependence of the real user id for qmail-inject: QMAILUSER, QMAILHOST, QMAILSUSER, QMAILSHOST, and QMAILINJECT to ifs.

Following functions are exported by this module:


This function returns all addresses of the given login. In a scalar context this is returned as a comma-separated lists, ready to be used within a To-header line. Otherwise, a list is returned.


This function returns just one of the addresses of the given login. Local university addresses are preferred if multiple addresses are available.


Return the address of the current user id. This is mainly useful to setup a valid From-header. Note, however, that Local::Email, if loaded, already sets all environement variables for qmail-inject.


This is equivalent to get_address(``root''), i.e. it returns the email address where administrative reports have to be sent to.

send_email($recipients, $subject, @msg)

Attempts to send an email to the given recipients (comma-separated in case of multiple addresses) with the given subject. All remaining arguments are joined with line terminators in between and at the end.


Andreas Borchert