Sendmail forwards to Lyris List Manager
Create an alias and tell Sendmail to forward email addressed to the alias to Lyris List Manager that runs on another port.
The main advantage of this approach is that it will work with virtually with any system configuration. Both Sendmail and Lyris List Manager can coexist on the same machine, without having to assign
new TCP/IP addresses or any other significant system changes.
Add DNS Entry
The first step in using this approach is to define an alias (an alternate name) for your machine.
Please note: You cannot use a DNS CNAME for this purpose, because newer versions of Sendmail will often detect the CNAME in the RCPT TO: address and rewrite it to be the host the CNAME
points to (canonical form). Thus, negating the purpose of creating the CNAME in the first place.
Instead, you should add a new 'A' record in your DNS with the "alias" name, pointing to the same TCP/IP address already used by your machine. There will then be two 'A' records for your TCP/IP
address, defining the two names.
For example, to define an alias called "lists" for a machine named "apollo" you would first locate the line which reads "apollo IN A 207.105.6.2", copy and duplicate that line, defining the alias
name in the second line. Your DNS file would read:
apollo IN A 207.105.6.2 ; the original host name list IN A 207.105.6.2 ; the new "alias" host name
Please consult your network administrator if you need help in doing this.
Add Entry to "hosts" file
If you haven't done so already, you must add an entry to the "hosts" file on your machine. Typically, the file will be found in /etc, and a host entry will look something like:
207.105.6.2 list.z.com list
This is only an example. Depending on which flavor of Unix or Linux you are running, there may be slight variations in the syntax of defining a host. As well, the file may not be
in /etc.
Once the machine has been configured to listen for the new hostname, you will need to stop and restart your network services for this to take effect.
Once your alias is configured, go ahead and install Lyris List Manager.
Move Lyris List Manager to Port 26
You now need to tell Lyris List Manager to listen for incoming SMTP connections on an alternate port. Because Sendmail will be listening to port 25 (the SMTP standard) you should pick something
which does not conflict. A common choice is port 26.
While you are installing Lyris List Manager, you will be given the option to do this through the installation program. Alternatively, you can inform Lyris List Manager that it should use the
alternate port with the "smtpport" command line parameter. For example:
Lyris List Manager will respond with "Successfully updated SMTP port number"
Configure Sendmail
Finally, you need to define a Sendmail rule, to tell Sendmail, to forward mail which is addressed to the alias (the new "DNS A record" you just created) to Lyris List Manager that is running on the
alternate port. The method described below was tested on RedHat Linux 6.1with Sendmail 8.9.3.
There are four steps involved: 1) define a mail delivery agent, 2) define a RULE 0 to look for your alias and use that delivery agent, 3) "allow" Sendmail to relay to the host, and 4) add an entry to
your mailertable.
Define a delivery agent: Edit /etc/mail/sendmail.cf (or wherever it may be on your system) and search for a line which begins with "M". This marks the beginning of your mail agent
definitions. When you find that, add the following entry to that section:
Mlyris, P=[IPC], F=mDFMuX8ak, E=\r\n, L=990, T=DNS/RFC822/SMTP, A=IPC $h 26
It is very important that you properly use tabs when adding this agent definition. There are tabs before each of the equates "P=", "T=", and "A="
This command defines the "lyris" mail agent with the following settings:
P=[IPC] - Send this message using the network. F=mDFMuX8ak - Tell sendmail how the delivery agent will behave. In turn, these are: m - "multiple recipients possible"; D - "Need Date:
in header"; F - "Need From: in header"; M - "Need Message-ID: in header"; u - "Preserve uppercase for username"; X - "Delivery agent needs RFC821 hidden dot"; 8 - "Suppress EightBitMode=m MIME
encoding"; a - "Run extended SMTP protocol"; k - "Don't check for loops in HELO command". E=\r\n - Use linefeed and carriage-return as end of line characters. L=990 - Set
990 as the maximum number of lines in a message. T=DNS/RFC822/SMTP - Used for DSN (Delivery Status Notification). A=IPC $h 26 - Arguments to give to mail agent (for IPC
delivery, the arguments indicate the hostname and port to pass the message to).
Create S0 rule: The next step is to add the rule that will direct Lyris-bound mail to the mail agent defined above. In the sendmail.cf file, search for a line that reads "S0" and
add this line below the "S0":
R$*<$*@list.z.com>$* $#lyris $@list.z.com :$1<$2@list.z.com>$3
In the above line, change the word "lists.z.com" in each of the 3 instances to your full hostname alias. The line above assumes that your domain name is "z.com" and that your Lyris
List Manager hostname alias is "list"
Here is a detailed analysis of the line
R$*<$*@list.z.com>$* $#lyris $@list.z.com :$1<$2@list.z.com>$3 --------[1]---------[2]-[3]-----[4]-------[5]-----------
Comments: [1] Searches for "list.z.com" in the RCPT TO: address: R$*<$*@list.z.com>$*. [2] Must be a tab (important: sendmail will start with an error
if you forget the tab). [3] Specifies the Lyris List Manager delivery agent: $#lyris. [4] Specifies the hostname: $@list.z.com . [5] Specifies the
complete username to deliver to: $:$1<$2@list.z.com>$3.
This line is not as complicated as it looks: all we have done is instructed Sendmail to look for "@list.z.com". In the RCPT TO: address, and forward messages that match this on to the "lyris" mail
agent.
Very important: The character before $#lyris must be a tab, all the other blanks must be a space, and must not be a tab. The rule will not work correctly unless this is exactly
right. Sendmail will give an error when you try to start it.
Be sure that you have changed the text "list.z.com" in all 3 places in the rule above, to be your Lyris List Manager host name.
"Allow" sendmail to relay to the alias: The next step is to configure Sendmail to allow relaying to the alias you are using for Lyris List Manager. Depending on your Sendmail
installation, you can either add an entry to the "Cw" command in your sendmail.cf file or you can add the hostname to /etc/mail/relay-domains.
Add entry to mailertable: The final step is to add an entry to the mailertable. Edit the /etc/mail/mailertable file by adding an entry like the following:
list.z.com lyris:[127.0.0.1]
You would replace the "list.z.com" with the alias of your Lyris List Manager. The alias is separated from the mailer entry by a tab. Once the mailertable entry is complete, the
final step is to run the "makemap" program. You should be in the /etc/mail directory when you run this command:
/usr/sbin/makemap hash mailertable < mailertable
Now, restart Sendmail. The easiest way to do this is to first "kill" Sendmail, then restart it with "/usr/lib/sendmail -bd"
To test that these changes work, start Lyris List Manager in the foreground with the "debug" parameter, like this: "lyris start debug". Then send email to the alias name, such as
"lyris@lists.mycorp.com". You should see immediate activity on the Lyris List Manager screen, indicating that the email message was received.
You should also receive a prompt reply to your email message from Lyris List Manager.
|