http:// qmail.jms1.net / squirrelmail-no-smtp.shtml

Making Squirrelmail not use SMTP

Squirrelmail is a popular webmail interface. It works with any IMAP server, and is stable enough that it is included as a standard package in most Linux distributions.

Some qmail install guides (notably qmailrocks) are telling people to configure Squirrelmail so that it uses SMTP AUTH when sending outbound mail, regardless of how the server is otherwise set up. While this can be a good idea in some cases, if they are both on the same machine it may not be necessary- and unless you have a real need for messages originating from the webmail interface to be processed through the SMTP server it actually wastes CPU cycles to force the messages through the SMTP server.

For systems where Squirrelmail and the SMTP server are on the same machine, it may be better to configure Squirrelmail to use "sendmail" for outgoing mail, rather than using SMTP. By "sendmail" I am not talking specifically about the old sendmail mail server program. All of my servers run qmail. By "sendmail" I am referring to the Squirrelmail configuration option "Sendmail or SMTP".

This page shows how to configure Squirrelmail to use a command-line program to send outbound mail, rather than using SMTP to connect to a server in order to send outbound mail.


Why you might NOT want to do this

Many SMTP servers scan incoming messages for viruses and spam. The chances of somebody manually typing (or copying and pasting) a virus into a webmail window are rather small, but you may occasionally run into a "user" who gets access to your webmail system and uses it to send spam. By having the webmail interface send all outbound messages through your SMTP server, your anti-spam filters would catch such a person and prevent their spam from getting out.

Some companies may also be keeping copies of all inbound and outbound email- and if the monitoring is being done at the SMTP level (which is not a very good way to do it, but people will do the strangest things sometimes) then you would need the mail to go through the SMTP server as well.

This solution (allowing Squirrelmail to use a command line program to send mail rather than using SMTP) may or may not be a good solution for your server- only you can make that decision. This page simply explains how to configure Squirrelmail if you do decide to go with the non-SMTP solution.

2008-03-17 Another option would be to set up a virus and/or spam scanner for qmail-inject (which is called by the "sendmail" wrapper program) using the same "glue" program (simscan, qmail-scanner, etc.) you would use for qmail-smtpd. This can be done by creating a QMAILQUEUE environment variable, since qmail-inject uses the same QMAILQUEUE variable that qmail-smtpd does.


Before we begin

Before we can re-configure qmail, there are a few pieces of information you will need:


Run the configuration script

The following shows how to run the configuration script:

As root...

# cd /usr/share/squirrelmail/config
# ./conf.pl

You will see a menu on the screen which looks like this:

SquirrelMail Configuration : Read: config.php (1.4.0)
---------------------------------------------------------
Main Menu --
1. Organization Preferences
2. Server Settings
3. Folder Defaults
4. General Options
5. Themes
6. Address Books (LDAP)
7. Message of the Day (MOTD)
8. Plugins
9. Database

D. Set pre-defined settings for specific IMAP servers

C. Turn color off
S Save data
Q Quit

Command >>

You will need to make the following choices from the menus. As you choose each item, you will see a new menu. Each successive choice on this list is an option on the menu which appears

You may need to restart Apache after making these changes.

Once you have changed these settings, any time a Squirrelmail user sends an outgoing message, it will be sent using the sendmail binary rather than the SMTP server.