NAME

Local::Email -- setup local email configuration


SYNOPSIS

   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", (
      "Hi,",
      "this is a short test message",
      "Bye"));
   my $root = Local::Email::get_rootaddress();


DESCRIPTION

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:

get_addresses($login)

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.

get_address($login)

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

get_my_address()

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.

get_rootaddress()

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.


AUTHOR

Andreas Borchert