Jump to content
dlevens

How To Install Squirrelmail - The Ultimate Guide

Recommended Posts

Well it is about time for me to start giving back to TCH and this great community. After about a month of trial and error I believe I have compiled everything you need to know to setup your own squirrelmail install as well as what I found to be the ultimate way to fight spam using cPanel Spam Assassin.

 

 

INSTALLING SQUIRRELMAIL:

note: items in bold require you to modify to match your own info

 

1. Download a stable version from http://www.squirrelmail.org/download.php

 

2. Unpack and upload the contents to /public_html/squirrelmail

 

3. Create a folder in your ftp root called .mysqmail

 

4. Create a data and tmp folder inside .mysqmail

(i.e. /.mysqmail/data & /.mysqmail/tmp)

 

5. Using File Manager from cPanel modify the three folders you made as follows:

.mysqmail (chmod 777)

data (chmod 770)

tmp (chmod 730)

 

6. Make sure and copy the default_pref from the data folder that came with your squirrelmail package over to your new data folder that you made in step 5.

 

Note: Step 7 is optional. As long as you created your data directory from step 3 & 4 in the location specified or at least above the public_html folder you can skip this step.

7. Create a helpdesk ticket and ask them to run the following commands:

cd /home/tchuserid/.mysqmail

chown -R nobody data

chown -R nobody tmp

chgrp -R nobody tmp

 

8. Go to your squirrelmail files that you extracted and uploaded to /public_html/squirrelmail and go the config directory. Copy config_default.php and rename to config.php then edit this config.php file to match the items below. Make sure and change the bold items to match your info.

 

$domain = 'companyname.com';

$useSendmail = true;

$smtpServerAddress = 'localhost';

$smtpPort = 25;

$sendmail_path = '/usr/sbin/sendmail';

$imapServerAddress = 'localhost';

$imapPort = 143;

$imap_server_type = 'uw';

$use_imap_tls = false;

$use_smtp_tls = false;

$smtp_auth_mech = 'none';

$imap_auth_mech = 'login';

$optional_delimiter = 'detect';

$pop_before_smtp = false;

$default_folder_prefix = '';

$show_prefix_option = false;

$default_move_to_trash = true;

$default_move_to_sent = true;

$default_save_as_draft = true;

$trash_folder = 'INBOX.Trash';

$sent_folder = 'INBOX.Sent';

$draft_folder = 'INBOX.Drafts';

$auto_expunge = true;

$delete_folder = false;

$use_special_folder_color = true;

$auto_create_special = true;

$list_special_folders_first = false;

$default_sub_of_inbox = false;

$show_contain_subfolders_option = false;

$default_unseen_notify = 2;

$default_unseen_type = 1;

$noselect_fix_enable = false;

$default_charset = 'iso-8859-1';

$data_dir = '/home/tchuserid/.mysqmail/data';

$attachment_dir = '/home/tchuserid/.mysqmail/tmp';

$dir_hash_level = 0;

$default_left_size = '150';

$force_username_lowercase = true;

$default_use_priority = true;

$hide_sm_attributions = true;

$default_use_mdn = true;

$edit_identity = false;

$edit_name = true;

$allow_thread_sort = false;

$allow_server_sort = false;

$allow_charset_search = true;

$uid_support = true;

$session_name = 'SQMSESSID';

 

YOUR DONE!

 

 

SETTING UP SPAM ASSASSIN WITH AUTOLEARN AND BAYES

1. From cPanel click on Spam Assassin and enable both the Spam Assassin and the Spam Box.

 

2. Using File Manager from cPanel edit the user_prefs file located here:

/.spamassassin/user_prefs

 

Make the file match this info:

auto_learn 1

ok_languages en

ok_locales en

report_safe 1

required_hits 8

rewrite_subject 0

skip_rbl_checks 0

subject_tag *****SPAM*****

use_bayes 1

use_dcc 1

use_pyzor 1

use_razor2 1

use_terse_report 0

 

note: if you edit this file any other way you need to use a program like textpad and make sure and save it in UNIX ANSI format. PC format or DOS will mess things up. There should not be a need for whitelists and blacklists anymore, instead just train spam assassin (shown below) to know what is spam and what is not.

 

After making these changes if you go to modify the spam assassin configuration via cPanel and then save the changes, for some odd reason cPanel will duplicate every line in this file. If you save again it will triplicate it. So I recommend you only add to your white and black list using file manager or textpad. OR back up this file, then make your change in cPanel and then edit it again in file manager or textpad and remove the duplicates.

 

For those of you who have played with Spam Assassin and noticed we do not have many options from cPanel, you will immediatly notice we can turn on auto learn and bayes filtering by doing it this way. This will give you a very powerful Spam filter that learns.

 

Another option to editing the file manually is using this utility to have it make one for you http://www.yrex.com/spam/spamconfig.php

 

3. Send yourself an email and view the header. You will now see Spam Assassin is working. Do not get confused if you see autolearn=no in the header. This is normal. It does not mean Spam Assassin autolearn is not on, it only means that the message did not meet the point level to be learned or it has already learned that message.

 

 

HOW TO TEACH SPAM ASSASSIN WHAT IS SPAM AND WHAT IS NOT

1. Using textpad or File Manager create two shell scripts in your /public_html/cgi-bin/ folder:

 

saham.sh

#!/bin/sh

echo "Learning HAM"

for FILE in `find $HOME/mail/****** -name inbox -print`

do

echo "Processing $FILE"

sa-learn --showdots --ham --mbox $FILE

done

echo "Done"

 

saspam.sh

#!/bin/sh

echo "Learning SPAM"

for FILE in `find $HOME/mail/****** -name spam -print`

do

echo "Processing $FILE"

sa-learn --showdots --spam --mbox $FILE

rm $FILE

touch $FILE

chmod 660 $FILE

done

echo "Done"

 

2. After you copy your two scripts to the cgi-bin folder, make sure you chmod both files to 755 or they will not run.

 

3. Note: the ham script will teach spam assassin what you think is good email. In the script we have it looking at every inbox file in your mail directory for your entire domain. So if you have 40 email accounts every single inbox file will be read. This script can be modified to look for other folders if you use them. For instance I use a folder called bills and one called personal. I could change inbox to bills or personal and have Spam Assassin learn those. You want to make sure that only good emails and NO spam reside in the folders you run with the ham script. Also know that you can run it on the same emails twice and Spam Assassin is smart enough to know it has learned them already and will look at them but will not learn any more from them. This is good if you do not archive your email for a long time, because you can run your script weekly and not have to worry that already learned email will be seen.

 

4. Now also note the spam script. This script will only work if you turned on Spam Box from cpanel, or if you manually create a spam folder. If you manually create a spam folder and call it something else, just change the name in the script to match. Any spam that spam assassin catches on its own will already be learned and put in the spam folder so this script is a little redundant. But the benefit comes from the email spam assassin misses. All you do is move them to the spam folder and then run the script and force spam assassin to learn that you think they are spam. NOW PLEASE NOTE! the two lines in red are dangerous. They will delete the entire spam file and all email in it and then create a new spam file. If you do not want your spam to be deleted by the script just remove those two lines. I use them because once spam assassin has seen them and learned from them I want them deleted anyway. This is nice because they are deleted and a new spam folder is created and ready to go.

 

5. To automate all of this just create a cron job that runs those scripts on a weekly basis or daily or whatever you need.

 

 

HOW TO CREATE A CRON JOB TO RUN YOUR SCRIPTS

 

- Login to cPanel

- Click on Cron Jobs

- Click on Standard

- In the "Command to run:" field type the path to your script:

/home/yourcpaneluserid/public_html/cgi-bin/saspam.sh

- Choose the times you want this to run:

Minute: 0

Hours: 22

Days: Every Day

Months: Every Month

Weekday: Monday

 

The above is just an example that if used your script will run every Monday at 10pm SERVER TIME. The server may not be in or set to the same time zone as you are. Best way to verify is to upload a file to your ftp and compare the timestamp. This way you can make sure that the scripts run when you intended them to run. For me the script above actually runs at 5am my time since the server is 7 hours ahead of me.

 

6. Click on Save Crontab

 

After setting things up like this, 95+ % of your spam should be caught. And ad each day goes buy and the more you teach SA what is spam and what is not that number will only go up. If you have a ton of good email and a ton of spam you can force Spam Assassin to learn both and you will be that much further ahead.

 

Anyway, just my two cents. I hope this helps.

 

Dennis Levens

 

This posted was last edited on July 20th 2004. As this thread grows I will try and modify my original post to add missing items and correct any mistakes.

Share this post


Link to post
Share on other sites

What is the advantage to setting up your own Squirrelmail vs using the SquirrelMail already availabe via the CPanel?

Share this post


Link to post
Share on other sites

1. It's newer. Squirrelmail is currently up to version 1.4.3a. Using Cpanel's install of Squirrelmail, you have no choice but to wait until they get around to updating their install.

 

2. Pluggins.

 

3. Customizability. I want to add custom login/out screens, theme, etc. to match my company's website.

Share this post


Link to post
Share on other sites

For most users the cpanel squirrelmail at http://www.******/webmail which runs on port 2095 or the sqmail at http://www.******/sqmail which runs on port 80 will be more than enough.

 

But like nate said, if you require plugins that are not installed on the serverwide install from TCH or if you need features that are only available in the newer versions of squirrelmail, then a stand alone install is your best bet.

 

I like to stay on the bleeding edge of squirrelmail releases and I want a ton of plugins to offer my users so I prefer my own install. I also like to control all the default settings for new users.

 

Dennis

Share this post


Link to post
Share on other sites
3. Create a folder in your ftp root called .mysqmail

Hello,

 

I'm not sure what the ftp root is: do you mean the public_ftp folder?

 

thanks,

Stefan

Share this post


Link to post
Share on other sites

Here is an example for running sh scripts from the browser. This will give your sh script's output back to the browser.

 

---------------PHP FILE BELOW-------------------------

#!/usr/bin/php

<html>

<body>

 

<?

$input = '/home/cpanel_user_name/public_html/cgi-bin/saham.sh';

$output = shell_exec("$input" . " 2>&1");

echo (nl2br("$output"));

?>

 

<br>

<br>

 

<?

$input = '/home/cpanel_user_name/public_html/cgi-bin/saspam.sh';

$output = shell_exec("$input" . " 2>&1");

echo (nl2br("$output"));

?>

 

<br>

 

</body>

</html>

 

--------------END PHP FILE-------------------------------

Share this post


Link to post
Share on other sites

I like that option. Time to learn me how to code in PHP. Running the scripts via cron give me an email with the results so will definately want the code to report back to the webpage. Would be sweet to have a secure website where I can just login in an run when I have my ham and spam ready for processing.

 

To go one step further do you know how to modify my scripts to so that the ham script will run against all files except (spam, sent, trash, draft)? The spam script is pretty much ready to go since I only use one spam folder for spam.

 

I know I cam modify the ham script to do what I want, I just don't know enough about shell scripting to do it. Would be nice, because now I have to make 15 scripts for the 15 folders I use for ham files.

 

Dennis

Share this post


Link to post
Share on other sites

phat, by root of your ftp I mean the first place you see when you login. This would be before the public_html

 

i.e.

/home/tchuserid/.mysqmail/public_html

 

basically the same place that you already have the following folders:

 

.spamassassin

.mysqmail

.sqmaildata

.trash

etc

mail

public_ftp

public_html

tmp

 

Dennis

Share this post


Link to post
Share on other sites
To go one step further do you know how to modify my scripts to so that the ham script will run against all files except (spam, sent, trash, draft)?

Instead of making 15 scripts, put all the scripts into one file. Just add the other folders to be scanned like I have shown an example below (look at the blue text, and substitute for your actual folder names.

 

 

 

saham.sh

#!/bin/sh

echo "Learning HAM"

 

for FILE in `find $HOME/mail/****** -name inbox -print`

do

echo "Processing $FILE"

sa-learn --showdots --ham --mbox $FILE

done

 

for FILE in `find $HOME/mail/****** -name folder1 -print`

do

echo "Processing $FILE"

sa-learn --showdots --ham --mbox $FILE

done

 

for FILE in `find $HOME/mail/****** -name folder2 -print`

do

echo "Processing $FILE"

sa-learn --showdots --ham --mbox $FILE

done

 

for FILE in `find $HOME/mail/****** -name folder3 -print`

do

echo "Processing $FILE"

sa-learn --showdots --ham --mbox $FILE

done

 

for FILE in `find $HOME/mail/****** -name folder4 -print`

do

echo "Processing $FILE"

sa-learn --showdots --ham --mbox $FILE

done

echo "Done"

Share this post


Link to post
Share on other sites

Don't forget. You are not allowed to run shell commands on our servers. I will have to have a look at this and let you know.

Share this post


Link to post
Share on other sites

You need to chmod your spam folder to 777 so that it can be deleted in the script.

The other mail folders can be 755, because they are being read, not written to.

 

 

Also, $HOME has a different meaning when ran through php that when it is used with cron, so use the absolute path instead of $HOME.

Share this post


Link to post
Share on other sites
Don't forget.  You are not allowed to run shell commands on our servers.  I will have to have a look at this and let you know.
Originally posted by Head Guru

If your scripts make server calls, fine. But if they cause issues, we will deal with it!

 

It looks like to me that this spam and ham might be okay as long as they don't cause issues.

Share this post


Link to post
Share on other sites
phat, by root of your ftp I mean the first place you see when you login. This would be before the public_html

Hi Dennis,

 

Thank you. By the way, GREAT work and research on your part. I've installed Squirrelmail on my domain previously, but ran into some major problems. Your work will make my own installation of Squirrelmail easier. Yes, it's definitely nice to use the personalized version of Squirrelmail, the plugins make it more functional.

 

peace,

Stefan

Share this post


Link to post
Share on other sites
To go one step further do you know how to modify my scripts to so that the ham script will run against all files except (spam, sent, trash, draft)?

Instead of making 15 scripts, put all the scripts into one file. Just add the other folders to be scanned like I have shown an example below (look at the blue text, and substitute for your actual folder names.

 

 

 

saham.sh

#!/bin/sh

echo "Learning HAM"

 

for FILE in `find $HOME/mail/****** -name inbox -print`

do

echo "Processing $FILE"

sa-learn --showdots --ham --mbox $FILE

done

 

for FILE in `find $HOME/mail/****** -name folder1 -print`

do

echo "Processing $FILE"

sa-learn --showdots --ham --mbox $FILE

done

 

for FILE in `find $HOME/mail/****** -name folder2 -print`

do

echo "Processing $FILE"

sa-learn --showdots --ham --mbox $FILE

done

 

for FILE in `find $HOME/mail/****** -name folder3 -print`

do

echo "Processing $FILE"

sa-learn --showdots --ham --mbox $FILE

done

 

for FILE in `find $HOME/mail/****** -name folder4 -print`

do

echo "Processing $FILE"

sa-learn --showdots --ham --mbox $FILE

done

echo "Done"

I currently have my script that way, but I would really like to build it so that it will run the ham script on all files except: spam, drafts, sent, trash. Like a condition or for loop. This way the script will work for my entire domain, and will run on each users mailbox and will avoid the folders where ham usually does not reside. If anyone knows how to write something like that it would be greatly appreciated.

 

Dennis

Share this post


Link to post
Share on other sites
Don't forget.  You are not allowed to run shell commands on our servers.  I will have to have a look at this and let you know.
Originally posted by Head Guru

If your scripts make server calls, fine. But if they cause issues, we will deal with it!

 

It looks like to me that this spam and ham might be okay as long as they don't cause issues.

That is why I am checking on it. I am not sure it is an issue so I wouldnt fret over it yet.

Share this post


Link to post
Share on other sites

This step is not necessary:

 

6. Create a helpdesk ticket and ask them to run the following commands:

cd /home/tchuserid/.mysqmail

chown -R nobody data

chown -R nobody tmp

chgrp -R nobody tmp

 

If you chmod the data and tmp directory to 770 it will run whether chowned to nobody or not.

Share this post


Link to post
Share on other sites

Rick,

 

Good to know. For those of us who have chown to nobody what chmod can we use and have it still work? I have my data directory below public_html so I guess it is not so import to make it more restrictive, but would be nice to know how tight it can go without breaking it.

 

Dennis

Share this post


Link to post
Share on other sites

The chmod settings you have should work fine. The problem with chowning to nobody is that you will no longer be able to access the files directly to chmod them.

Share this post


Link to post
Share on other sites

I edited the original post to reflect Rick's suggestions and also added the following critical line to the saspam.sh script

 

chmod 660 $FILE

 

without that line the spam file gets created with chmod 600 and as a result Spam Assassin does not have rights to send your spam mail to the spam folder.

 

fortunately I noticed my main cpanel id mailbox was getting loaded with messages from SA telling me it was not able to deliver my spam mail because it was expecting chmod 660 but was seeing 600.

 

Dennis

Share this post


Link to post
Share on other sites
I have my data directory above public_html so I guess it is not so import to make it more restrictive...

Someone please correct me if I am wrong. This information applies to linux webservers in general.

 

Having something above the public_html only protects it from web browsers - NOT OTHER SERVER USERS! (Although there are policies and possibly laws forbidding accessing other people's stuff.)

 

If you have a file called script.php in /home/userid directory, and the file is owned by you, and the file has 777 permissions, then anyone on the server can access, execute, modify, or delete it if they know the name of it. (They would have to know the name of the file because they would not be able to get a directory listing of the userid folder unless you changed your default permissions on that directory)

 

If the file is owned by nobody, then those same things applies, except it doesn't matter what the permissions are, since everybody has access to nobody.

Share this post


Link to post
Share on other sites

Thanks for the tutorial, Dennis. I installed SquirrelMail exactly as you described, and the permissions are as follows:

 

.mysqmail - 777

 

.mysqmail/data - 770

 

.mysqmail/tmp - 770

 

 

When I try to log in, I get the following error message -

 

Error opening ../data/default_pref

Could not create initial preference file!

../data/ should be writable by user nobody

Please contact your system administrator and report this error.

 

Do I need to do the helpdesk ticket chown thing after all?

 

Thanks.

 

Steve

Share this post


Link to post
Share on other sites

Permissions need to be set to 777 if Squirrelmail data is moved below your public html folder, or you must set permissions to 770/730 and put in a help desk ticket as described above.

 

770 will only work if the tmp & data folder are located in your public html folder.

 

At least, that's my take on it.

 

What I want to know is how do you write your cron command once you have your spam & ham scripts set up? Your tutorial is a little incomplete with out this. :lol:

Share this post


Link to post
Share on other sites
Thanks for the tutorial, Dennis. I installed SquirrelMail exactly as you described, and the permissions are as follows:

 

.mysqmail - 777

 

.mysqmail/data - 770

 

.mysqmail/tmp - 770

 

 

When I try to log in, I get the following error message -

 

Error opening ../data/default_pref

Could not create initial preference file!

../data/ should be writable by user nobody

Please contact your system administrator and report this error.

 

Do I need to do the helpdesk ticket chown thing after all?

 

Thanks.

 

Steve

Steve,

 

You should be able to fix this yourself without needing to use the helpdesk. Your chmod on the directories looks good. It sounds like you are just missing your default_pref file. Just copy it from the original squirrelmail package data folder. If needed download a fresh zipped package from www.squirrelmail.org and you will find this file in the data directory.

 

Then make sure that the chmod for that file is 644

 

After setting everything up and before your very first login to squirrelmail the default_pref should be the only file in your data directory. Once you login, squirrelmail reads that default_pref file and uses its defaults to create a unique data file for each user that logs in.

 

Dennis

Share this post


Link to post
Share on other sites
Permissions need to be set to 777 if Squirrelmail data is moved below your public html folder, or you must set permissions to 770/730 and put in a help desk ticket as described above.

 

770 will only work if the tmp & data folder are located in your public html folder.

 

At least, that's my take on it.

 

What I want to know is how do you write your cron command once you have your spam & ham scripts set up? Your tutorial is a little incomplete with out this. :lol:

Nate,

 

Good point on the cron job. Here is what you need to do:

 

assuming you have already made the scripts and moved them to your cgi-bin folder and have chmod them to 755

 

TO CREATE A CRON JOB TO RUN YOUR SCRIPTS

 

1. Login to cPanel

2. Click on Cron Jobs

3. Click on Standard

4. In the "Command to run:" field type the path to your script:

/home/yourcpaneluserid/public_html/cgi-bin/saspam.sh

5. Choose the times you want this to run:

Minute: 0

Hours: 22

Days: Every Day

Months: Every Month

Weekday: Monday

 

Using these settings your script will run every Monday at 10pm SERVER TIME

 

6. Click on Save Crontab

 

note: I put server time because the time on the server may not be the same time in your time zone. The best way to determin the difference is to upload a file to your ftp and check the timestamp and comare to your timezone. For me 10pm server time is actually 5am my time. I like my scripts to run at 5am so that I am not still moving email around and the chances of someone I know sending me a legit email at that time is rare so the spam script is safe to run without worrying if SA happened to mark a legit email as spam and my spam script killed it before I could check it.

 

Once your script runs the cron job results will be emailed to the email address you have setup in your cpanel under contact information. You can verify that by modifying this url to match your domain:

 

http://******:2082/frontend/bluelagoon/contact/index.html

 

Repeat the steps above to setup a seperate cron job for your ham script. Or you can combine both scripts into one file and set the cron to just run that file.

 

Dennis

 

note: I have updated my original post to add this info

Share this post


Link to post
Share on other sites

This is what Cron mails to me after it runs saspam.sh:

 

Learning SPAM

Processing /home/accountid/mail/website.com/user/spam

Argument "1\rok_languages en\rok_locales en\rreport_safe 1\rrequir..." isn't numeric

in addition (+) at /usr/lib/perl5/site_perl/5.8.1/Mail/SpamAssassin/Conf.pm line

1558.

.....................................................................................

........................................................

Learned from 108 message(s) (142 message(s) examined).

 

Is this normal?

Share this post


Link to post
Share on other sites

That is not normal, here is what mine always looks like:

 

Learning SPAM

Processing /home/userid/mail/******/user/spam

....

Learned from 4 message(s) (4 message(s) examined).

done

Does it seem to work besides the odd error? Does your spam get deleted and does your files increase in size in the .spamassassin folder?

 

I am not sure if this matters but is your scripts formatted in UNIX or PC or Dos? Mine are all UNIX ANSI.

 

Line 1558 in the Conf.pm file refers to the section of bayes autolearn feature. Can you verify that your user_prefs file in your .spamassassin folder looks like this:

auto_learn 1

ok_languages en

ok_locales en

report_safe 1

required_hits 8

rewrite_subject 0

skip_rbl_checks 0

subject_tag *****SPAM*****

use_bayes 1

use_dcc 1

use_pyzor 1

use_razor2 1

use_terse_report 0

 

And also verify that your user_prefs file is UNIX ANSI format. The easiest way to determine this and fix this is to use textpad and open the file then change format to UNIX ANSI and save as to desktop then delete your copy in your ftp and upload the new file.

 

Dennis

Share this post


Link to post
Share on other sites

I got squirrel installed and working perfectly... now I am trying to figure out how to get it to let me log in without typing the domain (i.e. instead of user123@domain.com, just user123). I did find the vhost plugin on squirrelmail.org, and managed to install and configure it, but it doesn't seem to be doing what I'd like for it to do. Anyone have a suggestion? :)

Share this post


Link to post
Share on other sites

If you cannot get vlogin to work there is another plugin login alias that does the same thing. Otherwise make sure you have the latest version of vlogin (3.4 I think) and then check your config.php in your vlogin/data folder and look for a line

$dontUseHostName = 0;

 

make sure it is 0

 

Dennis

Share this post


Link to post
Share on other sites

Thanks for this great guide.

I'm still haveing problems with "Error opening ../data/default_pref"

I have made all required directores and set their permissions:

.mysqmail > 777

.mysqmail/data > 777 and tried it with 770

.mysqmail/tmp > 777 and tried it with 730

.mysqmail/data/defalut_pref > 644

 

Any suggestions?

 

 

------------

AbuJenin

Share this post


Link to post
Share on other sites

Assuming you have the default_pref file in your data directory and it is CHMOD 644 then my guess would be your pathing is wrong in your config.php file.

 

Make sure your config.php has this for data:

 

$data_dir = '/home/tchuserid/.mysqmail/data';

 

If that was not the problem then go through the guide once more to double check each step.

 

Dennis

Share this post


Link to post
Share on other sites

I made the correction to the /data path in config.php; and after trying to log in, it created a ahmed@jenin.ws.pref file there.

However, now I am getting strange errors at the login page:

 

 

Warning: session_start(): Cannot send session cookie - headers already sent by (output started at /home/jeninws/public_html/squirrelmail/config/config.php:828) in /home/jeninws/public_html/squirrelmail/functions/global.php on line 295

 

Warning: session_start(): Cannot send session cache limiter - headers already sent (output started at /home/jeninws/public_html/squirrelmail/config/config.php:828) in /home/jeninws/public_html/squirrelmail/functions/global.php on line 295

 

Warning: Cannot modify header information - headers already sent by (output started at /home/jeninws/public_html/squirrelmail/config/config.php:828) in /home/jeninws/public_html/squirrelmail/functions/i18n.php on line 280

 

Warning: Cannot modify header information - headers already sent by (output started at /home/jeninws/public_html/squirrelmail/config/config.php:828) in /home/jeninws/public_html/squirrelmail/src/login.php on line 50

 

 

What went wrong?

 

--------

AbuJenin

Share this post


Link to post
Share on other sites

Sounds like you got some major issues. First thing I noticed is the error is coming from line 828 in config.php but your config.php file should not be that big. Mine is only 215 lines long. Double check your config.php file and see what is on line 828.

 

I assume you are using squirrelmail 1.4.3a?

 

Also did you upload the zip file and use file manager to extract your squirrelmail install or did you upload every file using ftp? IF using the later you need to make sure your ftp program is smart enough to upload the right files in ACSI and some in binary. The safest approach is to just download a clean copy of squirrelmail then upload that zip file and use file manager from cpanel to extract it. Then edit from there.

 

Dennis

Share this post


Link to post
Share on other sites

I did upload squirrelmail the safe way using cpanel. As you said, it was a problem with config.php, maybe from an error the last time I edited it; deleting the old config.php and editing a new one solved the problem.

 

Thanks Dennis

 

AbuJenin

Share this post


Link to post
Share on other sites

Hey dlevens! I know it's been said before, but you did a great guide. It is much appreciated!

 

One question about the Spam Assassin - can I set this up the way you've prescribed even if I don't install a personal version of SquirrelMail?

 

Also, how can I access the plugins that are provided by TCH?

 

Thanks!

Share this post


Link to post
Share on other sites

Kevness,

 

Yes, you can customize spam assassin without needing a custom install of squirrelmail. You can use the default TCH install of squirrelmail or even horde to access your spam folder. Just follow all the steps except the install of squirrelmail.

 

As far as accessing the plugins provided by TCH you need to be more specific. I am not sure what you are asking. There are no plugins provided by TCH for squirrelmail. They do have a few plugins installed on the default squirrelmail install but you cannot add or install any plugins to the default install since it is serverwide and controlled by TCH. Any custom plugins you want can only be installed to your own squirrelmail install, which brings us to the reason why I wrote this guide.

 

Dennis

Share this post


Link to post
Share on other sites

As far as I know you cannot check the spam folder with the TCH installed version of squirrelmail. Only with Horde.

Share this post


Link to post
Share on other sites
As far as I know you cannot check the spam folder with the TCH installed version of squirrelmail. Only with Horde.

Not entirely true. Horde and SquirrelMail both can access the spam folder, Neomail is the only one that cannot.

Share this post


Link to post
Share on other sites

Thanks for the verification on the Spam Assistant!

 

Regarding the plugins, what I really want to know is what plugins are available through the TCH installed version of SquirrelMail? And how do I access them?

 

Also, how can I redirect a person back to my site upon sign-out? If this is a question better served with a new thread, just let me know. I don't want to clutter this guide too much :P

Share this post


Link to post
Share on other sites

Here are the plugins that I believe are installed for squirrelmail here at TCH:

 

You dont need to set these up they are just there. To access them you just use squirrelmail. To set the options for them go to squirrelmail and then click on options. Not all plugins will have options.

 

Squirrelmail 1.4.0

 

>calendar
delete_move_next
filters
message_details
newmail
squirrelspell
sent_subfolders
abook_take
abook_import_export

 

Dennis

Share this post


Link to post
Share on other sites

Hi guys,

 

I've got some questions that will look very straight forward for you I'm sure, but I'm not very familiar with sqmail...

I'm currently using Sqmail on a resseler account.

 

Here are my question:

 

- following Dennis's tutorial, shall I overwrite the previous sqmail installation (the standard TCH one)?

- I'm using sqmail because it's available on port 80, will the new version be available through port 80 too?

- if i'm doing all those modifications on the resseler account, will those modification be available for all the children accounts too? If not, must I redo everything once per account?

- Is there a way of going back to the current version of sqmail if something goes wrong?

- By the way, is-is possible to acces another mail package through port 80?

 

thanks a lot guys!

 

S.

Share this post


Link to post
Share on other sites
- following Dennis's tutorial, shall I overwrite the previous sqmail installation (the standard TCH one)?
You are not overwriting TCH's version you are installing your own copy. Whether it uses your current mailboxes I am unsure. (Dennis would know)

 

- I'm using sqmail because it's available on port 80, will the new version be available through port 80 too?

 

Yes

 

- if i'm doing all those modifications on the resseler account, will those modification be available for all the children accounts too? If not, must I redo everything once per account?
You will have to do it for each domain you want to change.

 

- Is there a way of going back to the current version of sqmail if something goes wrong?

 

I would think you would be able to, but unsure of what you would have to remove to make it so.

 

- By the way, is-is possible to acces another mail package through port 80?

 

Of the three offered by TCH I don't think so. Someone will correct me if I am wrong.

Share this post


Link to post
Share on other sites

Hi Bruce,

 

about the "overwritting" thing, I meant that If I install my own version of sqmail (a newer one I guess),:

- does that mean that I'll be able to access it using *****/sqmail ?

- is there two versions available on the server?

 

cheers

 

S.

Share this post


Link to post
Share on other sites

Don't have that answer. I would assume you would be pointing to where ever you install your version of Squirrel Mail and the link you posted would bring up the TCH installed verison but I could be wrong. I have not installed my own version for I use POP mail and only need web mail when I am away from home/work.

Share this post


Link to post
Share on other sites

HI guys,

 

I followed all the steps you mention in the tutorial but I can't connect to the new squirrelmail installation.

 

When I'm typing *****/sqmail i got the previous login screen (automatically filled as *****/sqmail/src/login.php).

 

Where is the new installation path? the new loggin? I extracted the new package in /home/tchuser/public_html/squirrelmail/ but when I try to access the login.php page from this new package at *****/squirrelmail/src/login.php I get the following errors:

 

Warning: main(../functions/strings.php): failed to open stream: No such file or directory in /home/proceed/public_html/squirrelmail/src/login.php on line 19

 

Fatal error: main(): Failed opening required '../functions/strings.php' (include_path='.:/usr/lib/php:/usr/local/lib/php') in /home/proceed/public_html/squirrelmail/src/login.php on line 19

 

Does that make sense to you? what did I miss?

 

regards,

 

S.

Share this post


Link to post
Share on other sites

Hey guys, curious why I did not get an email saying some replied to this topic? Seems like this happens to me all the time, even though I am subscribed to the thread. Anyway thats another issue.

 

svl2706, I think you are confused. Hopefully I can clear some things up for you.

 

you wont be able to replace or even change the install of squirrelmail located at http://www.******/sqmail since you do not have access to where those files are located. The most damage you could do is to create a subdomain called sqmail and foul up the redirection that takes place. Just think of the install at sqmail as untouchable. This is running on port 80 and a great backup if you have issues with your own install.

 

Now your own install is located at what ever folder you name it under public_html it is no different than creating another webpage. Think of sqmail as a webpage and you just created another webpage at squirrelmail. I dont recommend using the full path to login in. For you stand alone install you would use

 

http://www.******/squirrelmail

 

It will of course run on port 80 as it is just a webpage. No different than any others you have in your public_html.

 

You can have as many email clients you want running on port 80. Just like you can have as many webpages running on port 80 as you want. You are only accessing the email client that you point to in your browser and only that install will respond.

 

It sounds like you have something wrong in your install. Your issue is most likely a pathing issue. Retrace your steps going through my guide.

 

As far as accessing the mail folders you can access the same data from as many installs of squirrelmail as you like. By default you will always see the same email no matter what squirrelmail you use. I believe the sendmail path determines where your email is stored and I do not believe you can change that. You can however change where your data folder is which holds your preferences and addressbook etc.

 

I have mine setup so that the one at sqmail and my install squirrelmail and my testing install at squirrelmailcvs all point to the same different folders. Your mail folders are always above your public_html folder in mail. Your data and preference folder for the sqmail install is .sqmaildata and if you followed my guide your own install the data and preferences are in .mysqmail/data

 

I see the same email whether I use horde, neomail or sqmail or my own squirrelmail. You can even have them all use the same data folder if you want.

 

Just change the path in your config.php file.

 

Dennis

Share this post


Link to post
Share on other sites
Hey guys, curious why I did not get an email saying some replied to this topic? Seems like this happens to me all the time, even though I am subscribed to the thread. Anyway thats another issue.

Dennis, you have to logout of the forums not just close the browser when you are done reading it for the notifications to work.

Share this post


Link to post
Share on other sites

Everytime I visit the forums I just close the browser window and do not log out, yet I just got a notification for your reply. Plus I access this forum from like 5 different machines but on all machines I just close the browser, obviously the session is killed so there is nothing saying I am still logged in, but are you saying there is some trigger than tells the forum that I am still logged in so dont email me a notice? What if someone replied to a post while I was logged in and reading the forums, how would I know they replied if no notify emails are sent while I am logged in?

 

Are you sure it works this way? If so then this is the only forum I visit that does it this way, and it seems like a poor way to run things, as while you are browsing around all replies to your posts are never emailed to you.

 

Dennis

Share this post


Link to post
Share on other sites
Are you sure it works this way? If so then this is the only forum I visit that does it this way, and it seems like a poor way to run things, as while you are browsing around all replies to your posts are never emailed to you.

That is what I was told how it works.

 

I don't subscribe to any of the forums. I read all new posts several times a day.

Share this post


Link to post
Share on other sites

HI Dennis,

 

thanks for your help on this I understand now how it works. Basically installing a new version of squirrel mail is like installing any PHP application.

 

So I remade all your process, line after line, changing the bold parts you metionned and I still get the same error when I try to connect to my new path...

 

Warning: main(../functions/strings.php): failed to open stream: No such file or directory in /home/proceed/public_html/squirrelmail/src/login.php on line 19

 

Fatal error: main(): Failed opening required '../functions/strings.php' (include_path='.:/usr/lib/php:/usr/local/lib/php') in /home/proceed/public_html/squirrelmail/src/login.php on line 19

 

 

Does that mean anything to you?

Share this post


Link to post
Share on other sites

I sent you a personal message with my email. Email me the files when you get a chance and I will see if we can't figure this out.

 

Dennis

Share this post


Link to post
Share on other sites

Thanks for the tutorial, dlevens. I was just getting ready to start setting up email accounts for my users, and I think I'm going to go with a custom installation instead of using TCH's version.

 

Here's my question, and I suspect I already know the answer. Is using cpanel the only way to set up new accounts? I would like my users to be able to set up their own email accounts, so that I don't have to know the password. Is there anything that can do that? Normally I write PHP scripts for what I want done (learning it fast, and it's a lot of fun), but I don't think that's an option for this.

 

Thanks in advance for any help anyone can provide!

Share this post


Link to post
Share on other sites

Syenna,

 

I am not familiar with another way to create mailbox accounts without using cpanel. I suggest creating all accounts using the same password and instruct the users to change the password at first login. Cpanel provides away to do this but they would be logging into the cpanel squirrelmail. The ideal way is to install a plugin that gives password changing capability but it is not easy. It took me awhile to figure it out.

 

Dennis

Share this post


Link to post
Share on other sites

Ahhh yes, I see the plugin now that will enable a user to change their password (http://www.squirrelmail.org/plugins_category.php?category_id=5 for anyone else who's interested). Thanks.

 

Question is, which one do I use? Do I use the one that allows the user to transparently use cpanel? Actually, I think a better question to ask is, which one are you using? ;)

 

Syenna

Share this post


Link to post
Share on other sites

Syenna,

 

After many hours of painful trial and error the only password changing plugin that works for us at TCH is the CPanel Password Changer located

 

here

http://squirrelmail.org/plugin_download.php?id=204&rev=911

 

to save you some pain follow the instructions for installing it then make sure your config.php file looks like mine and make sure and find and change the UPDATE THIS with your cpanel username and password. It is listed 3 times in my sample below, everything else I already updated to match our info here at TCH.

 

config.php

><?php 
//What are your CPanel "login" values?
//They are needed for authentication when calling CPanel files directly.
//Don't worry, nothing will be displayed to the user!

$cpanel_un = "UPDATE THIS";	// Your Cpanel username.
$cpanel_pw = "UPDATE THIS";	// Your CPanel password.


//Where is the CPanel pop password change file located?
//This will be different for every CPanel theme. You can find the file
//location by going into the CPanel POP Email Accounts area and then 
//right-clicking on the "Change Password" link.  Choose the 
//"Copy shortcut" option and then cut/paste it here.
//NOTE: Do NOT include the domain/port info or anything after the filename.

$cpanel_file_location = "/frontend/bluelagoon/mail/dopasswdpop.html";


//This is the text string that will be used to determine if the password
//change was successful or not.  Since this string may be different for
//every theme, you should perform a password change using CPanel and then
//find some text that is *displayed* (visable) ONLY when the change was 
//successful. In other words, if this string is found in the CPanel results 
//then the//pw change is considered successful.  If this string is NOT found 
//then the pw change is considered NOT successful.

$cpanel_success_string = "was successfully modified";


//If you want see the raw output of the CPanel command, set this to true.
//The default is true. (You should set this to false before allowing
//general users to use this plugin.)

$show_cpanel_output = false;


//Should the user be automatically logged out from SM after password change?
//If set to true, then the $show_cpanel_response setting is ignored.
//The default is false.

$disconnect = false;


//Do you want to change the password of a "web protected" (htaccess) file, too?
//This is useful if the SAME username/password combination is beingused to 
//protect a folder. It will keep things in synch for you.
//NOTE: The folder must already be protected using the CPanel "web protect" 
//tool using the same username used for the email account.
//The default is false.

$do_htaccess_change = true;

//If you have set $do_htaccess_change to true, then you MUST also set the 
//following values:

$protect_file_path = "/home/UPDATETHIS/public_html/cgi-bin";	// Full path to protected folder
$cpanel_protect_file_location = "/frontend/bluelagoon/htaccess/newuser.html";	// Location of CPanel file.
$cpanel_protect_success_string = "now has the password";	//Text to look for to determine success.


//Include the languages file of your preference. They are listed 
//inside of the language folder. If you make a new file in your 
//language, please send it to the plugin developers to it can be 
//included in this package.
//The default is the English language file.

$language_file = 'english.php';

?>

 

Let me know if you have problems.

 

Dennis

Share this post


Link to post
Share on other sites

That's awesome, Dennis. Thanks a bunch!

 

I will work on this over the next couple of days and holler at you if I have any problems.

 

Thanks again!

Syenna

Share this post


Link to post
Share on other sites

I was looking into this guide and it is very detailed.

 

One question I did have that wasn't fully answered.

 

How do you setup SquirrelMail from Cpanel to be able to access it from a coporate firewall? I don't need extra features of the latest updates, simple, short and sweet.

 

Thanks

 

Sean

Share this post


Link to post
Share on other sites

Well, I briefly dabbled with idea of trying to install the custom Squirrelmail. Still in the process of working out the bugs. However, in the meantime, I cannot get the public version of squirrelmail to work now. *****/sqmail. I am getting this error:

-----------------------------------

Warning: Unknown(): open_basedir restriction in effect. File(/usr/local/squirrelmail-1.4.3a/index.php) is not within the allowed path(s): (/home/mycpanelname/:/usr/lib/php:/usr/local/lib/php:/tmp) in Unknown on line 0

 

Warning: Unknown(/usr/local/squirrelmail-1.4.3a/index.php): failed to open stream: Operation not permitted in Unknown on line 0

 

Warning: (null)(): Failed opening '/usr/local/squirrelmail-1.4.3a/index.php' for inclusion (include_path='.:/usr/lib/php:/usr/local/lib/php') in Unknown on line 0

------------------------------------

I do not have any of the customized squirrelmail files or folder in my root folder at the moment. Did I delete something I shouldn't have? I was careful about only deleting the stuff I installed.

 

-j

Share this post


Link to post
Share on other sites

Joxley,

 

I've gotten the same error since a couple of hours.

I've already opened a ticket but so far they are not searching in the right direction.

 

I'll keep you posted

Share this post


Link to post
Share on other sites

OK,

 

That makes some sense although not happy with the way this is communicated.

And a further tip. Let the tech's that answer to my ticket also provide the reason why I should login to serverxx etc.

Now they only told me that with that url it works fine.. Not telling me that for security reasons the other option is canceled.

Now I have wasted another email telling them that I wanted to also log in with my former url using my domain name. Not knowing what you just told us Mike.

 

A bit of waste of time and bandwidth :P

Share this post


Link to post
Share on other sites
Some security holes were fixed that would allow someone access to the server, thats why you are getting thet error now. you will need to use http://serverXX.totalchoicehosting.com/sqmail in order to access it

 

XX being the server you are on

Thanks Mike! I suppose patching security holes is a reasonable excuse for this minor inconvenience. I'm just relieved it wasn't something I did when messing with a personal customized version of squirrelmail.

Share this post


Link to post
Share on other sites

Can someone give me step-by-step instructions for how to get the vlogin plugin to work? I think I may be missing something when I try and add it.

 

Thanks.

Share this post


Link to post
Share on other sites

I am having a similar problem to abujenin:

 

 

I made the correction to the /data path in config.php; and after trying to log in, it created a ahmed@jenin.ws.pref file there.

However, now I am getting strange errors at the login page:

 

 

Warning: session_start(): Cannot send session cookie - headers already sent by (output started at /home/jeninws/public_html/squirrelmail/config/config.php:828) in /home/jeninws/public_html/squirrelmail/functions/global.php on line 295

 

Warning: session_start(): Cannot send session cache limiter - headers already sent (output started at /home/jeninws/public_html/squirrelmail/config/config.php:828) in /home/jeninws/public_html/squirrelmail/functions/global.php on line 295

 

Warning: Cannot modify header information - headers already sent by (output started at /home/jeninws/public_html/squirrelmail/config/config.php:828) in /home/jeninws/public_html/squirrelmail/functions/i18n.php on line 280

 

Warning: Cannot modify header information - headers already sent by (output started at /home/jeninws/public_html/squirrelmail/config/config.php:828) in /home/jeninws/public_html/squirrelmail/src/login.php on line 50

 

 

What went wrong?

 

--------

AbuJenin

 

 

 

 

But mine are more like this:

 

Warning: session_start(): open(/tmp/sess_3e3ad2a88908ad325007c8011779c8dd, O_RDWR) failed: Permission denied (13) in /home/coreysm/public_html/squirrelmail/functions/global.php on line 295

 

Warning: session_start(): Cannot send session cache limiter - headers already sent (output started at /home/coreysm/public_html/squirrelmail/functions/global.php:295) in /home/coreysm/public_html/squirrelmail/functions/global.php on line 295

 

Warning: Cannot modify header information - headers already sent by (output started at /home/coreysm/public_html/squirrelmail/functions/global.php:295) in /home/coreysm/public_html/squirrelmail/functions/i18n.php on line 280

 

Warning: Cannot modify header information - headers already sent by (output started at /home/coreysm/public_html/squirrelmail/functions/global.php:295) in /home/coreysm/public_html/squirrelmail/functions/global.php on line 267

 

Warning: Cannot modify header information - headers already sent by (output started at /home/coreysm/public_html/squirrelmail/functions/global.php:295) in /home/coreysm/public_html/squirrelmail/src/login.php on line 50

 

 

I have been working on this for a couple of days now and I have uploaded and deleted over and over again with no success.

 

I have created my config.php several times, still without success.

 

Any help anyone could provide I would greatly appreciate.

 

 

 

EDIT: I figured it out - closing firefox and reopening made the errors go away.

Share this post


Link to post
Share on other sites

Are there any Squirrelmail plugins available to allow users to create their own email accounts (with some sort of email verification process)?

 

Regards

 

rowanp.

Share this post


Link to post
Share on other sites
5. Using File Manager from cPanel modify the three folders you made as follows:

    .mysqmail (chmod 777)

    data (chmod 770)

    tmp (chmod 730)

 

I'm new to all this, and "chmod" means absolutely nothing to me - looking at below replies, however, it seems that it might be the "permissions" in cPanel? Is this correct? If so, when I attempt to change from the default 755, it refuses... for all three items you suggest to change. Any ideas?

 

Thanks.

Chris.

Share this post


Link to post
Share on other sites

Yes, chmod is changing the permissions. In the File Manager in CPanel be sure to use the check boxes rather than just typing in the numbers. You can also change the permissions in most FTP programs by right clicking on the filename or folder.

Share this post


Link to post
Share on other sites

It's a short unix command for CHange MODe. And welcome to the forums!

Share this post


Link to post
Share on other sites

Thank you for the kind welcomes, everyone!

 

So, I've got the chmods/permissions of the folders .mysqmail, data, and tmp (placed in the recommended directory) changed to the recommended values, however, when I run the configtest given in the readme file that came inside squirrelmail (http://www.example.com/yourwebmaillocation/src/configtest.php), it came back saying it could not read/write to the Data dir or the Attachment dir, until I changed the permissions from what was recommended (770 and 730 to 776 and 732). (Is this safe to set these this way?) Now those work, but it says the "location of sendmail program incorrect (/usr/sbin/sendmail)". Was I supposed to create this? All I have done (aside from changing permissions to get the data and tmp dir's to work) is what was listed in this thread.

 

Ugh. All this just to use html formatting in my e-mail. :)

 

Thanks for any assistance!

Chris.

Edited by Chris Hooker

Share this post


Link to post
Share on other sites
Well it is about time for me to start giving back to TCH and this great community. After about a month of trial and error I believe I have compiled everything you need to know to setup your own squirrelmail install as well as what I found to be the ultimate way to fight spam using cPanel Spam Assassin.

 

 

INSTALLING SQUIRRELMAIL:

note: items in bold require you to modify to match your own info

 

1. Download a stable version from http://www.squirrelmail.org/download.php

 

2. Unpack and upload the contents to /public_html/squirrelmail

 

3. Create a folder in your ftp root called .mysqmail

 

4. Create a data and tmp folder inside .mysqmail

    (i.e. /.mysqmail/data & /.mysqmail/tmp)

 

5. Using File Manager from cPanel modify the three folders you made as follows:

    .mysqmail (chmod 777)

    data (chmod 770)

    tmp (chmod 730)

 

6. Make sure and copy the default_pref from the data folder that came with your squirrelmail package over to your new data folder that you made in step 5.

 

Note: Step 7 is optional. As long as you created your data directory from step 3 & 4 in the location specified or at least above the public_html folder you can skip this step.

7. Create a helpdesk ticket and ask them to run the following commands:

cd /home/tchuserid/.mysqmail

chown -R nobody data

chown -R nobody tmp

chgrp -R nobody tmp

 

8. Go to your squirrelmail files that you extracted and uploaded to /public_html/squirrelmail and go the config directory. Copy config_default.php and rename to config.php then edit this config.php file to match the items below. Make sure and change the bold items to match your info.

 

$domain = 'companyname.com';

$useSendmail = true;

$smtpServerAddress = 'localhost';

$smtpPort = 25;

$sendmail_path = '/usr/sbin/sendmail';

$imapServerAddress = 'localhost';

$imapPort = 143;

$imap_server_type = 'uw';

$use_imap_tls = false;

$use_smtp_tls = false;

$smtp_auth_mech = 'none';

$imap_auth_mech = 'login';

$optional_delimiter = 'detect';

$pop_before_smtp = false;

$default_folder_prefix = '';

$show_prefix_option = false;

$default_move_to_trash = true;

$default_move_to_sent = true;

$default_save_as_draft = true;

$trash_folder = 'INBOX.Trash';

$sent_folder = 'INBOX.Sent';

$draft_folder = 'INBOX.Drafts';

$auto_expunge = true;

$delete_folder = false;

$use_special_folder_color = true;

$auto_create_special = true;

$list_special_folders_first = false;

$default_sub_of_inbox = false;

$show_contain_subfolders_option = false;

$default_unseen_notify = 2;

$default_unseen_type = 1;

$noselect_fix_enable = false;

$default_charset = 'iso-8859-1';

$data_dir = '/home/tchuserid/.mysqmail/data';

$attachment_dir = '/home/tchuserid/.mysqmail/tmp';

$dir_hash_level = 0;

$default_left_size = '150';

$force_username_lowercase = true;

$default_use_priority = true;

$hide_sm_attributions = true;

$default_use_mdn = true;

$edit_identity = false;

$edit_name = true;

$allow_thread_sort = false;

$allow_server_sort = false;

$allow_charset_search = true;

$uid_support = true;

$session_name = 'SQMSESSID';

 

YOUR DONE!

 

 

SETTING UP SPAM ASSASSIN WITH AUTOLEARN AND BAYES

1. From cPanel click on Spam Assassin and enable both the Spam Assassin and the Spam Box.

 

2. Using File Manager from cPanel edit the user_prefs file located here:

/.spamassassin/user_prefs

 

Make the file match this info:

auto_learn 1

ok_languages en

ok_locales en

report_safe 1

required_hits 8

rewrite_subject 0

skip_rbl_checks 0

subject_tag *****SPAM*****

use_bayes 1

use_dcc 1

use_pyzor 1

use_razor2 1

use_terse_report 0

 

note: if you edit this file any other way you need to use a program like textpad and make sure and save it in UNIX ANSI format. PC format or DOS will mess things up. There should not be a need for whitelists and blacklists anymore, instead just train spam assassin (shown below) to know what is spam and what is not.

 

After making these changes if you go to modify the spam assassin configuration via cPanel and then save the changes, for some odd reason cPanel will duplicate every line in this file. If you save again it will triplicate it. So I recommend you only add to your white and black list using file manager or textpad. OR back up this file, then make your change in cPanel and then edit it again in file manager or textpad and remove the duplicates.

 

For those of you who have played with Spam Assassin and noticed we do not have many options from cPanel, you will immediatly notice we can turn on auto learn and bayes filtering by doing it this way. This will give you a very powerful Spam filter that learns.

 

Another option to editing the file manually is using this utility to have it make one for you http://www.yrex.com/spam/spamconfig.php

 

3. Send yourself an email and view the header. You will now see Spam Assassin is working. Do not get confused if you see autolearn=no in the header. This is normal. It does not mean Spam Assassin autolearn is not on, it only means that the message did not meet the point level to be learned or it has already learned that message.

 

 

HOW TO TEACH SPAM ASSASSIN WHAT IS SPAM AND WHAT IS NOT

1. Using textpad or File Manager create two shell scripts in your /public_html/cgi-bin/ folder:

 

saham.sh

#!/bin/sh

echo "Learning HAM"

for FILE in `find $HOME/mail/****** -name inbox -print`

do

echo "Processing $FILE"

sa-learn --showdots --ham --mbox $FILE

done

echo "Done"

 

saspam.sh

#!/bin/sh

echo "Learning SPAM"

for FILE in `find $HOME/mail/****** -name spam -print`

do

echo "Processing $FILE"

sa-learn --showdots --spam --mbox $FILE

rm $FILE

touch $FILE

chmod 660 $FILE

done

echo "Done"

 

2. After you copy your two scripts to the cgi-bin folder, make sure you chmod both files to 755 or they will not run.

 

3. Note: the ham script will teach spam assassin what you think is good email. In the script we have it looking at every inbox file in your mail directory for your entire domain. So if you have 40 email accounts every single inbox file will be read. This script can be modified to look for other folders if you use them. For instance I use a folder called bills and one called personal. I could change inbox to bills or personal and have Spam Assassin learn those. You want to make sure that only good emails and NO spam reside in the folders you run with the ham script. Also know that you can run it on the same emails twice and Spam Assassin is smart enough to know it has learned them already and will look at them but will not learn any more from them. This is good if you do not archive your email for a long time, because you can run your script weekly and not have to worry that already learned email will be seen.

 

4. Now also note the spam script. This script will only work if you turned on Spam Box from cpanel, or if you manually create a spam folder. If you manually create a spam folder and call it something else, just change the name in the script to match. Any spam that spam assassin catches on its own will already be learned and put in the spam folder so this script is a little redundant. But the benefit comes from the email spam assassin misses. All you do is move them to the spam folder and then run the script and force spam assassin to learn that you think they are spam. NOW PLEASE NOTE! the two lines in red are dangerous. They will delete the entire spam file and all email in it and then create a new spam file. If you do not want your spam to be deleted by the script just remove those two lines. I use them because once spam assassin has seen them and learned from them I want them deleted anyway. This is nice because they are deleted and a new spam folder is created and ready to go.

 

5. To automate all of this just create a cron job that runs those scripts on a weekly basis or daily or whatever you need.

 

 

HOW TO CREATE A CRON JOB TO RUN YOUR SCRIPTS

 

- Login to cPanel

- Click on Cron Jobs

- Click on Standard

- In the "Command to run:" field type the path to your script:

    /home/yourcpaneluserid/public_html/cgi-bin/saspam.sh

- Choose the times you want this to run:

    Minute: 0

    Hours: 22

    Days: Every Day

    Months: Every Month

    Weekday: Monday

 

The above is just an example that if used your script will run every Monday at 10pm SERVER TIME. The server may not be in or set to the same time zone as you are. Best way to verify is to upload a file to your ftp and compare the timestamp. This way you can make sure that the scripts run when you intended them to run. For me the script above actually runs at 5am my time since the server is 7 hours ahead of me.

 

6. Click on Save Crontab

 

After setting things up like this, 95+ % of your spam should be caught. And ad each day goes buy and the more you teach SA what is spam and what is not that number will only go up. If you have a ton of good email and a ton of spam you can force Spam Assassin to learn both and you will be that much further ahead.

 

Anyway, just my two cents. I hope this helps.

 

Dennis Levens

 

This posted was last edited on July 20th 2004. As this thread grows I will try and modify my original post to add missing items and correct any mistakes.

 

 

HI Dennis Levens

 

This is a wonderful HOW TO...

 

I manage to set SQMAIL up following It, but i have run into a little problem

when i log into www.mydomian/squirrelmail i have the following error messages:

 

ERROR

Error opening ../data/default_pref

Could not create initial preference file!

/.mysqmail/data/ should be writable by user skyeagle

Please contact your system administrator and report this error.

 

What could possibly have gone wrong.

 

Can you please help me out. I need assistance.

 

Thanks

 

hyspah

Share this post


Link to post
Share on other sites

Welcome to the forums hyspah

 

If you are getting an error that it cannot open or create a file it is most likely a permissions problem.

 

Make sure your permissions are set as per step 5 above.

Share this post


Link to post
Share on other sites

Create an account or sign in to comment

You need to be a member in order to leave a comment

Create an account

Sign up for a new account in our community. It's easy!

Register a new account

Sign in

Already have an account? Sign in here.

Sign In Now


×