A PCRE internal error occured. This might be caused by a faulty plugin
====== Differences ====== This shows you the differences between two versions of the page.
Both sides previous revision Previous revision Next revision | Previous revision | ||
packages:postfix [2014/02/07 04:07] admin [Install Postfix] |
packages:postfix [2014/02/07 05:00] (current) admin [Test Postfix] |
||
---|---|---|---|
Line 12: | Line 12: | ||
You'll be asked what type of installation you'd like to setup. In this example we'll go for an external relay, so , when asked, we choose "Internet with smathost" as the installation option. | You'll be asked what type of installation you'd like to setup. In this example we'll go for an external relay, so , when asked, we choose "Internet with smathost" as the installation option. | ||
- | {{:packages:postfix:install-type.png?200}} | + | {{ :packages:postfix:install-type.png?direct&200 |}} |
+ | |||
+ | You'll then be prompted to enter a domain name that will be used to qualify addresses WITHOUT A DOMAIN NAME, enter an adequate domain name here. Do this so others cannot abuse your mail system. You can later change this value using: | ||
+ | <code> | ||
+ | sudo postconf -e "myorigin = domainname.tld" | ||
+ | </code> | ||
+ | |||
+ | This value will be saved in// /etc/mailname/ //. | ||
+ | |||
+ | Also a default relay host will be asked, leave it blank to route your mails directly to the SMTP service of the target address. | ||
+ | |||
+ | ===== Configure Postfix ===== | ||
+ | |||
+ | Your hostname (computer name) can be set with the following command. (Use command "hostname" at the command-line to display your hostname if not sure.) | ||
+ | <code> | ||
+ | postconf -e "myhostname=server1.example.com" | ||
+ | </code> | ||
+ | |||
+ | Add the domain names that your system will handle. | ||
+ | <code> | ||
+ | postconf -e "relay_domains = example.com, example2.com, example3.com" | ||
+ | </code> | ||
+ | |||
+ | Reload Postfix Server: | ||
+ | <code> | ||
+ | postfix reload | ||
+ | </code> | ||
+ | |||
+ | ===== Relay Authentification ===== | ||
+ | If your relay host requires authentication, or blocks port 25, you'll need to further configure Postfix: | ||
+ | |||
+ | <code> | ||
+ | apt-get install libsasl2-modules | ||
+ | </code> | ||
+ | |||
+ | <code> | ||
+ | postconf -e "relayhost = [smtp.domainname.tld]:587" | ||
+ | postconf -e "smtp_sasl_auth_enable = yes" | ||
+ | postconf -e "smtp_sasl_password_maps = hash:/etc/postfix/sasl_passwd" | ||
+ | postconf -e "smtp_sasl_security_options = noanonymous" | ||
+ | </code> | ||
+ | |||
+ | Create a file called sasl_passwd in// /etc/postfix/sasl_passwd//. Inside type in | ||
+ | <code> | ||
+ | sudo nano /etc/postfix/sasl_passwd | ||
+ | |||
+ | [smtp.domainname.tld]:587 username@domainnanme.tld:mypassword | ||
+ | </code> | ||
+ | |||
+ | Now change permissions so others can't read it: | ||
+ | <code> | ||
+ | chmod 600 /etc/postfix/sasl_passwd | ||
+ | </code> | ||
+ | |||
+ | Now postmap it. (It creates a database-like file so postfix can read it.) | ||
+ | <code> | ||
+ | postmap /etc/postfix/sasl_passwd | ||
+ | </code> | ||
+ | |||
+ | Restart postfix | ||
+ | <code> | ||
+ | postfix reload | ||
+ | </code> | ||
+ | |||
+ | Done. You can use "mutt" to send emails outside. Check /var/log/mail.log to see if everything is working. | ||
+ | ===== Test Postfix ===== | ||
+ | You should nbow be able to send mail to the outside world using Postfix: | ||
+ | <code> | ||
+ | telnet localhost 25 | ||
+ | </code> | ||
+ | |||
+ | You should see: | ||
+ | <code> | ||
+ | Trying 127.0.0.1... | ||
+ | Connected to localhost.localdomain. | ||
+ | Escape character is '^]'. | ||
+ | 220 server1.example.com ESMTP Postfix (Debian/GNU) | ||
+ | </code> | ||
+ | |||
+ | Send an email to a test recipient: | ||
+ | <code> | ||
+ | mail from:<you@youremail.com> | ||
+ | rcpt to:<user@example.com> | ||
+ | data | ||
+ | To: user@example.com | ||
+ | From: you@youremail.com | ||
+ | Subject: Hey my first email | ||
+ | This is my first email on debian postfix after installing configuring it. | ||
+ | It was easy. | ||
+ | </code> | ||
+ | |||
+ | To end data hit enter, type in a dot, and hit enter again: | ||
+ | <code> | ||
+ | . | ||
+ | </code> | ||
+ | |||
+ | Quit the session: | ||
+ | <code> | ||
+ | quit | ||
+ | </code> |