Category: Mail Server

Linux sendmail installation, setup and configuration

By peter, September 11, 2009



1. Search for and install “qpopper”. SuSE 11 doesn’t include qpopper so you will need to have a look for another pop utility/program
2. Search for “sendmail” and install. You might need to uninstall Postfix as it will conflict with sendmail.
3. Vi the /etc/xinetd.d/qpopper file and change setting to “disabled = no”

Edit the /etc/xinetd.d/qpopper file

Edit the /etc/xinetd.d/qpopper file




4. Close and save the file
5. Edit the “/etc/mail/access” file and add the following at the end of the file

192.168 RELAY

6. Edit the “/etc/mail/local-host-names” file and add your domain name at the end of the file

yourdomain.co.za

7. Edit the “/etc/mail/relay-domains” file and add the following at the end of the file

192.168

yourdomain.co.za

8. Edit the “/etc/sysconfig/sendmail” file and insert the smtp server you will be relaying mail through.

sendmailcfg1

9. Edit the “/etc/sysconfig/mail” file and add insert your domain as follows:

sendmailcfg2

10. Also, in the same file, “/etc/sysconfig/mail”, change “SMTP_LISTEN_REMOTE = no” to “yes” as follows:

sendmailcfg3

How to send mail from the shell prompt

By peter, September 11, 2009

To send a mail from the command prompt use the following command (all in one line):

mail -v -r reply@address.co.za -s “subject goes here” -a /pathto/attachment.txt < /pathto/bodyofmail.txt recipient@destinationaddress.co.za

You may like to use this command in a script, or just from the command prompt as a quick way of e-mailing someone a file

Setting up a basic Postfix Mail Server

By peter, September 11, 2009

The following is based on SuSE 10.2

The most popular mail program at the moment is “Postfix”.

Make sure that you have installed the following:

1) Postfix – for sending and receiving mail to your server)

2) qpopper – to allow users to collect mail from your server. (SuSE 11 doesn’t include qpopper, search for another pop utility/program instead)

Setting up Postfix

qpopper:
Vi the /etc/xinetd.d/qpopper file and change setting to “disabled = no”

edit the /xinetd.d/qpopper file

edit the /xinetd.d/qpopper file




Postfix:

Vi the “/etc/sysconfig/mail” file and change “SMPTD_REMOTE_LISTEN = YES”

Vi the “/etc/sysconfig/postfix” file and change the following:
“POSTFIX_LOCALDOMAINS” and add in the domain names you will receive. Eg below

POSTFIX_LOCALDOMAINS=”yourdomain.co.za”

set the “POSTFIX_BASIC_SPAM_PREVENTION” to “medium” eg follows:

POSTFIX _BASIC_SPAM_PREVENTION=”medium”

If you are using a dialup modem, then you will need to set the “POSTFIX_DIALUP” to “yes” and “POSTFIX_NODNS” to “no”.
You might need to edit the “/etc/postfix/main.cf” file as well and check some of the settings like “myhostname” if you are receiving for yourdomain.co.za and not for computername.yourdomain.co.za. Also check things like “mydestination” and put in all the domains for which you receive mail.

Restart “xinetd” and “postfix”. Restarting xinetd will allow qpopper to become active

Testing

Go into the “Shell”
Type “telnet your_server_ip_address 25” (25 is the smtp port)
Type”telnet your_server_ip_address 110” (110 is the pop3 port)
If you connect, your mail is working!

For trouble shooting, if something isn’t working correctly, view the log files. This will help you to determine why something isn’t working correctly

TIP

To see the log, type the following into the shell:

tail /var/log/mail

to see the log as it happens type the following:

tail -f /var/log/mail

For general messages “tail -f /var/log/messages”

The mail queue
Sending
If the mail is either delayed while waiting for a modem connection, or you have set “defer_transports = smtp” then your mail will be waiting in a mail queue. You can see the content of the mail queue by typing the command “mailq” at the command prompt.

To send queued mail use the “sendmail -q” command.

Receiving
Unless your “mx” record is pointing to your static IP address, then you are going to have to use “fetchmail” to receive mail.

vi the “/root/.fetchmailrc” file similar to the following example:

poll 192.168.114.3 protocol pop3 username peterh password 3ry691+ is peterh

poll 192.168.114.3 protocol pop3 username thabangs password hfs065( is thabangs

Notice the format:

poll mail server protocol pop3 username “username” password “password” is local user
Set a con job to run “fetchmail -a” at the desired intervals
You will need to change permissions on the “.fetchmailrc” file to at least “0710″ as follows:
chmod 0710 .fetchmailrc

Test by typing “fetchmail -v -a” at the command prompt.

OfficeFolders theme by Themocracy