Skip to main content

Set up Mail Server on Ubuntu

PHP send email setup

http://ph.ubuntuforums.com/showthread.php?t=887081

To install postfix

sudo apt-get install postfix

Intall mailx package for use as command mail utility program. Mail command is installed with this package.

sudo apt-get install mailx

Add a user before you start this.

sudo useradd -m -s /bin/bash fmaster
sudo passwd fmaster

Test your default installation using the following code segment.

telnet localhost 25

Postfix will prompt like following in the terminal so that you can use to type SMTP commands.

Trying 127.0.0.1...
Connected to mail.fossedu.org.
Escape character is '^]'.
220 localhost.localdomain ESMTP Postfix (Ubuntu)

Type the following code segment in Postfix's prompt.

ehlo localhost
mail from: root@anywher.com
rcpt to: support@localhost
data
Subject: My first mail on Postfix

Hi,
Are you there?
Regards,
Admin
.(Type the .[dot] in a new Line and press Enter )
quit

Check the mailbox of support

su - support (change user to support after login to the host)
mail
Setting Postfix support for Maildir-style mailboxes

GUI -
https://help.ubuntu.com/community/Postfix
Manually

Maildir is a format for an e-mail spool that does not require file locking to maintain message integrity because the messages are kept in separate files with unique names. A Maildir is a directory (often named Maildir) with three subdirectories named tmp, new, and cur. The subdirectories should all reside on the same filesystem.

Another reason to use Maildir format is that Courier IMAP/POP3 servers only work with Maildir format of mailboxes.

Please find out more about Maildir here

Instruct Postfix to use Maildirs instead of Mboxes:

sudo postconf -e "home_mailbox = Maildir/"

Ensure Procmail isn't used: (if the step was taken during dpkg-reconfigure, by mistake)

sudo postconf -e "mailbox_command = "

Restart Postfix to make changes effect.

sudo  /etc/init.d/postfix restart
Test your setup again

Installing courier IMAP and POP3
sudo apt-get install courier-pop
sudo apt-get install courier-imap

Adding your local domains to postfix

Add your domains to mydestination:

sudo postconf -e "mydestination = mail.thecoolmeter.com, localhost.localdomain, localhost, thecoolmeter.com"

Add your local networks, too:

Postfix comes with the localhost (127.0.0.1) entry; you may have others, here we assume your LAN is on 192.168.1.0/24. Make changes to suit your situation.

sudo postconf -e "mynetworks = 127.0.0.0/8, 192.168.1.0/24"

Make Postfix to receive mail from the Internet

Instruct Postfix to receive on all interfaces:

sudo postconf -e "inet_interfaces = all"

(optional) Make Postfix accept IPv4, IPv6 protocols

If you're not using IPv6 yet, and you're paranoid, use "ipv4" instead of "all". Again, this is to suit your own network sensibilities.

sudo postconf -e "inet_protocols = all"

Finally, restart Postfix;

sudo  /etc/init.d/postfix restart

Test your setup again using following code:

telnet mail.yourdomain.com 25 ehlo yourdomain.com mail from: root@yourdomain.com rcpt to: fmaster@yourdomain.com data Subject: My first mail for my domain  Hi, Are you there? regards, Admin . (and Enter In a new Line) quit

Check the mailbox of fmaster

su - fmaster
cd Maildir/new
ls

Testing Courier POP3

Type in a terminal:

telnet mail.yourdomain.com 110

Use the following example code segment for your test. Be intelligent to tweak the changes appropriately to your environment. An output like follows will display in your terminal.

Connected to mail.yourdomain.com (208.77.188.166). Escape character is '^]'. +OK Hello there.

Type the following code segment in the prompt provided by the Courier POP3 server. I assume that you are intelligent enough not to type the lines which starts from +OK

user fmaster +OK Password required. pass password +OK logged in. quit

Testing Courier IMAP

Type in a terminal:

telnet mail.yourdomain.com 143

Use the following example code segment for your test. Be intelligent to tweak the changes appropriately to your environment. An output like follows will display in your terminal.

* OK [CAPABILITY IMAP4rev1 UIDPLUS CHILDREN NAMESPACE THREAD=ORDEREDSUBJECT THREAD=REFERENCES SORT QUOTA IDLE ACL ACL2=UNION STARTTLS XCOURIEROUTBOX=INBOX.Outbox] Courier-IMAP ready. Copyright 1998-2005 Double Precision, Inc.  See COPYING for distribution information.

Type the following code segment in the prompt provided by the Courier IMAP server.

a login fmaster password a OK LOGIN Ok. a logout

User email anywhere to access the mail

Comments

Popular posts from this blog

เวรย่อมระงับด้วยการไม่จองเวร

"เวรย่อมระงับด้วยการไม่จองเวร" ที่เป็นภาษาอังกฤษและมีความหมายใกล้เคียงนั้น ก็มีหลายสุภาษิตด้วยกัน (ส่วนตัวแล้ว ชอบ "Good to forgive; best to forget.") ลองพิจารณาและเลือกเอาเอาตามใจชอบจาก "สุภาษิต" ข้างล่างนี้..... - To forget a wrong is the best revenge. - Revenge never repairs an injury. - Pardon is the most glorious revenge. - Good to forgive; best to forget.

Book of Answer Privacy Policy

Privacy Policy Privacy Policy Jaa Yoo built the Book of Answer app as a Free app. This SERVICE is provided by Jaa Yoo at no cost and is intended for use as is. This page is used to inform visitors regarding my policies with the collection, use, and disclosure of Personal Information if anyone decided to use my Service. If you choose to use my Service, then you agree to the collection and use of information in relation to this policy. The Personal Information that I collect is used for providing and improving the Service. I will not use or share your information with anyone except as described in this Privacy Policy. The terms used in this Privacy Policy

How to agree in English - too / neither /either / so

1. To agree with postive statement (Me too) “I love strawberry ice cream.” “Me too!” “I’ve been traveling a lot for work lately.” “Me too.” “I’m going to the beach tomorrow.” “Me too!” 2. To agree with negative statement (Me neither) “I can’t draw very well.” “Me neither.” “I haven’t seen the new movie yet.” “Me neither.” “I don’t go to the gym very often.” “Me neither.” 3. To respond in positive (So do I) “I always sleep late on the weekends.” “So do I.” “I’m from Moscow.” “So am I!” “I studied chemistry in college.” “So did I.” 4. To respond in negative (Neither do I, Nor do I, I don't either) “I don’t think that’s a good idea.” “Neither do I.”“Nor do I.” “I don't either.” “I’m not very outgoing.” “Neither am I.” “Nor am I.” “I'm not either.” “I didn’t like broccoli when I was a kid.” “Neither did I.” “Nor did I.” “I didn't either.”