Tek-Tips is the largest IT community on the Internet today!

Members share and learn making Tek-Tips Forums the best source of peer-reviewed technical information on the Internet!

  • Congratulations IamaSherpa on being selected by the Tek-Tips community for having the most helpful posts in the forums last week. Way to Go!

New to sendmail is the a step by step? 1

Status
Not open for further replies.

AccessXP

IS-IT--Management
Jan 29, 2002
132
New to sendmail is the a step by step?

Thanks.
 
starting where? With getting a domain name? Setting up dns "MX" record to point to your ip? Installing sendmail? Configuring sendmail? Securing sendmail? It is not very complicated and we are willing to answer any question you have but give us a place to start. Also let us know what type of connection you have to the internet.



 
I appologize...in the area of Configuring sendmail? Securing sendmail? and then adding squirrelmail but I would ask that in a different form right?

Thanks again.
 
You would use apache to give users access to squirrelmail so to answer your question you would ask that in the apache forum. Now geting back to sendmail. Although many linux distros come with more than one mail server, sendmail is the one that is usually configured to start at bootup. That being the case, I won't go into the particulars of setting that up. Sendmail's main configuration file is /etc/mail/sendmail.mc and is the first thing we will edit. So open it with your favorite text editor. The first thing you need to do is look for these two lines:

TRUST_AUTH_MECH(`EXTERNAL DIGEST-MD5 CRAM-MD5 LOGIN PLAIN')dnl
define(`confAUTH_MECHANISMS', `EXTERNAL GSSAPI DIGEST-MD5 CRAM-MD5 LOGIN PLAIN')dnl

If there is a dnl in front of them, that means they are commented out. The dnl means disregard everything until you come to a new line. Simply remove the dnl. The dnl at the end of the line is to get rid of the white space. Next look for a line like this:

DAEMON_OPTIONS(`Port=smtp,Addr=127.0.0.1, Name=MTA')dnl

Either comment it out, remove it or edit 127.0.0.1 to your server's ip otherwise, sendmail will not look at the network device for mail.

Now you are all done with sendmail.mc but sendmail can't use it like this because a lot of info is missing. So what we will do now is build the configuration file using a macro compiler called m4. This takes sendmail.mc and other .mc files and compiles them into sendmail.cf. To do that issue this command:

m4 /etc/mail/sendmail.mc > /etc/mail/sendmail.cf

Doesn't get any easier than that does it? Sendmail needs to know which domain this server will be providing mail for. To do that open /etc/mail/local-host-names and list all the domains your server will be hosting. You don't have to do anything to that file other than save it. Now you will need to make sure saslauthd is running and set to start at bootup. You will also need a pop3/imap server start at bootup. I like dovecot. It doesn't require any configuration at all. At this point you mail server should be up and running. However, the bad news, You need to create a table of users ant tell sendmail where that users mail goes. If you have a lot of users, I pitty you. ;-) What this table does is allow for virtual user names such as sales, webmaster, admin and so on. Here is a very short example of what the file looks like. Basically, each line has a virtual email address and a username or external e-mail address:

webmaster@domain1.com joe
joe@domain1.com joe
sales@domain1.com mike@otherdomain.net
mike@domain1.com mike
@domain1.com nouser This server does not allow spam!

You would do the same for each of your domains. Notice where some email points to a name. That name is a user on you linux system So for example, all mail for webmaster@domain1.com will go to /var/spool/mail/joe where joe is a file that contains all joes mail. When a user logs into his pop3 account with his username and password, this file get sent to that user's client where the file is converted to the standard email format of individual email messages. At the bottom, you will notice I added @domain1.com with no user name. This is a catchall. If mail comes in and there is no match an error message is returned with the text you put on that line. When you are done, save the file as /etc/mail/virtusertable. There may be one allready but it would be blank. Now you need to create the actual map sendmail will use. Just issue this command:

makemap hash /etc/mail/virtusertable.db < /etc/mail/virtusertable. One more file you need to edit is /etc/aliases. Notice that most of the names are aliased to root. Then down at the bottom root is aliases to marc or some other name. Put you user name there and uncomment the line. To create /etc/aliases.db, simply type newaliases on the command line. This should get you up and running. Now all you need to do is configure your mail client. What you want to do is tell it to send you username and password to the outgoing server as well as the incoming server. Let me know if you need more spacific help with that. Let me know how things turn out and I will help you get spammassassin setup.

 
RhythmAce,

Thanks i will do all the things you have listed. How do I increase the file size attachments for squirrelmail?

I once had some config files you posted for me a long time ago and I have lost them, but I do know that you have greatly helped me in the past with linux things.

So my hat is off to you and thanks again...

Accessxp.
 
RhythmAce,

Where do I create the table and what do I call it for the following,

webmaster@domain1.com joe
joe@domain1.com joe
sales@domain1.com mike@otherdomain.net
mike@domain1.com mike
@domain1.com nouser This server does not allow spam!

Thanks.
 
There should be an empty file called /etc/mail/virtusertable. If not create it as a plain text file then issue this command:

makemap hash /etc/mail/virtusertable.db < /etc/mail/virtusertable

I'm not sure about how set attachment size in squirrelmail because I haven't used it in years. I took a quick peek at the config and didn't see it there. I'm going to guess that is is set in php.ini some place. Mind you, that is just a guess.



 
RhythmAce,

Could you help out with spammassassin setup?

Also which form would i ask my squirrelmail questions?


Thanks.
 
The first thing you need to do is make sure spamassassin starts on bootup. Next we need to tell the localmailer (procmail) to pass all mail to spamassassin. Edit /etc/procmailrc and add these lines:

Code:
DROPPRIVS=yes
:0fw
| /usr/bin/spamc

Now we ain't gonna have it do nothing fancy. All we want it to do is mark stuff it thinks is junk mail as [SPAM] deliverer it as it normally would. So open /etc/mail/spamassassin/local.cf and add these lines:

Code:
required_hits 5
report_safe 0
rewrite_header subject [SPAM]



Your other options are to put the spam in a special folder on the mail server or just chuck it. Since the recipient wouldn't have access to these, I just have spamassassin mark them as spam and move along. There are a lot of ways that you can tell spamassassin what spam looks like but I just want to get you up and running. There may be people here that can help with with configuring it so it's a little tighter or check their website. Hope this helps.

 
why would this show up next to the user name and not the domain name?

@c17-ss-2-lb.cnet.com
 
I do not have this fold in that location.

/etc/procmailrc?
 
when I send email through squirrelmail to any email account the mail arrives with the user account as follows,

username@c17-ss-2-lb.cnet.com
not
username@mydomain.com

?????
 
Status
Not open for further replies.

Part and Inventory Search

Sponsor

Back
Top