easy-to-follow Postfix guide?

12 respuestas [Último envío]
muhammed
Desconectado/a
se unió: 04/13/2013

I'm having trouble with Ubuntu's Postfix guide.

"dix mx yourdomain.com" didn't work; I tried installing dnsutils but that didn't seem to help.

"telnet localhost 25" gives me this response:

Trying 127.0.0.1...
Connected to localhost.
Escape character is '^] '
220 trisquel ESMTP Postfix (Ubuntu)

I'm not sure what the output means. That escape character doesn't help me get back to muhammed@trisquel, so I get stuck at this step.

I tried the "sendmail" command. I wanted to email "fmaster@localhost" like in the guide. It didn't work unfortunately.

It's probably me and not the guide. But I thought I'd ask for some advice. Is there an easier way to make postfix work?

muhammed
Desconectado/a
se unió: 04/13/2013

I mean "dig mx", not "dix mx".

BugRep
Desconectado/a
se unió: 04/05/2012

^] means CTRL+]
It is easy to use telnet to test if the mail server is running and I can see yours is. You can use telnet to send email also, but it is is easier to run

mail muhammed@trisquel

Then ignore Cc by pressing enter, write a subject and press enter. Everything else you write is the message body. When you finish writing, press enter and then CTRL+D.

muhammed
Desconectado/a
se unió: 04/13/2013

Thanks BugRep

"CTRL ]" gives me the prompt "telnet>" ... I'm not sure what I can do from here, or how to return to "muhammed@trisquel:".

I mailed myself with "mail muhammed@trisquel", and it seemed to go well. When I try and chek my mailbox by entering "mail", I get this message:

"Cannot open mailbox /var/mail/muhammed: Permission denied
No mail for muhammed"

I tried the command "ehlo localhost" as well, from the Ubuntu guide. I get the response "command not found".

I'll keep trying

Mampir
Desconectado/a
se unió: 12/16/2009

"EHLO localhost" is command you write when connected to Postfix via telnet or nc (netcat). I use nc instead of telnet, like this:

nc localhost 25

This command connects you to your mail server. When connected, you start a sort of conversation with you mail server. The server says something, then you, then the the server, and so on.

When you connect the server first says:

220 trisquel ESMTP Postfix (Ubuntu)

This is basically a greetings from the server, introducing itself and telling you that it's running fine. Now you can respond with something the server understands. You can write something like this in nc and press enter (new line):

EHLO localhost

This is you, introducing yourself to the server by saying "HELLO" and that you are "localhost". After this command, the server will respond back with list of all of it capabilities. It might say something like this:

250-trisquel Hello localhost
250-SIZE 52428800
250-PIPELINING
250-STARTTLS
250-AUTH
250 HELP

This list tells what you can do with the server. If you see STARTTLS, this means the server can START an ecrypted communication using TLS.

When you want to stop the communication with the server, you can write:

QUIT

The server will respond with something like:

221 trisquel closing connection

Then the communication will finish, nc will close and you'll be back in Bash.

Using this method you can also send messages, using the commands "MAIL FROM", "RCPT TO" and "DATA". Like this:

220 libtec.org ESMTP Exim 4.76 Sun, 19 Jan 2014 13:41:47 +0200
MAIL FROM:<mampir@libtec,org>
250 OK
RCPT TO:<muhammed@localhost>
250 Accepted
DATA
354 Enter message, ending with "." on a line by itself
Hi, Muhammed!
.
250 OK
QUIT
221 libtec.org closing connection

Every lines starting with a number code, such as 250, is from the mail server. These codes identify the different types of responses the server can give. The codes are usually followed by more details.

Also, "EHLO" is used as a "HELLO" command, because there is an older command called "HELO". The older one was more commonly used, before "EHLO" was made-up.

Hope all this makes sense to you. :)

BugRep
Desconectado/a
se unió: 04/05/2012

Ctrl+D to return to shell prompt.

You might not have the mailbox. Execute:
sudo touch /var/mail/muhammed
sudo chown muhammed:mail /var/mail/muhammed
sudo chmod 600 /var/mail/muhammed

muhammed
Desconectado/a
se unió: 04/13/2013

Thanks so much for your help guys, I got much further into the guide this time.

I'm now at "Adding your local domains to postfix". The guide assumes that my LAN is on 192.168.1.0/24 -- is there any way to check this before I go ahead?

Edit: I'm asking for this step by the way:
sudo postconf -e "mynetworks = 127.0.0.0/8, 192.168.1.0/24"

Mampir
Desconectado/a
se unió: 12/16/2009

If you know your computer's IP address, you'll know the addresses of your network. There are many ways to check your computer's address.

From the network icon in your desktop panel, select "Connection Information". There you'll see "IP Address:" and your IP address next to it.

What I do is use a terminal, by typing:

ip addr

There you'll see a numbered list of devices and information about them. Each device has a label such as lo, eth0, eth1 or wlan0. Devices like eth are used when you are connect via a LAN cable. Devices like wlan are for WiFi connection. The lo is a special virtual device, used for connecting to yourself.

If you're using a wireless connection, then read the information of wlan0. There you should see inet and your IP address.

If your IP address is 192.168.1.107, then your network is 192.168.1.0/24. The /24 means your local network is the addresses from 192.168.1.0 to 192.168.1.255. If it was /16, that would mean from 192.168.0.0 to 192.168.255.255.

As I understand, if you set Postfix's mynetworks option this way, computer's on your you'll local network will be able to send emails from your server.

muhammed
Desconectado/a
se unió: 04/13/2013

Thanks Mapir

I'm using a wired connection, which I is eth0 on the server pc. I see the lo and wlan that you mentioned as well.

The IP address is next to inet, then "brd", then another IP address without any "/", then "scope global eth0". All on the same line. I guess use the first one right? What's the second one for?

There's an inet6 right below inet, but the address (?) that follows it looks different from the IP address format (beginning with 192) that you posted.

Mampir
Desconectado/a
se unió: 12/16/2009

Use the first IP, right next to inet. For example:

inet 192.168.1.107/24 brd 192.168.1.255 scope global eth0

In the above, your IP is 192.168.1.107 and your network is 192.168.1.0/24.

I don't yet understand much about IP networks. What I understand by reading in Wikipedia just now, brd 192.168.1.255 is the broadcast address of the network. It is used to send a messages to all addresses on the network.

The address after inet6 is your IPv6 address , while the address 192.168.1.107 is your IPv4 address. The IPv6 address is different and its written in hexadecimal notation. IPv6 (Internet Protocol version 6) is meant to replace IPv4 (Internet Protocol version 4), but IPv4 is still more widely used. These two protocols are technologies needed communication between computers on the Internet and local networks.

Using the IPv6 address is not crucial for setting Postfix for now.

muhammed
Desconectado/a
se unió: 04/13/2013

I'm having trouble with netcat again.

"nc mail.mydomain.ca" gives me this message:
"nc: get addrinfo: Name or service not known"

Do you know how I can tell the computer (to know the address)? This is for the Testing Courier POP3 stage. I skipped the optional "Make Postfix accept IPv4, IPv6" stage, because of a similar nc hurdle.

Mampir
Desconectado/a
se unió: 12/16/2009

I know two reasons for receiving this:

  • The domain name you've written doesn't exist
  • You are not connected the Internet

You can connect to your mail server using an IP address, rather than a domain name. You can write for example:

nc -v 192.168.1.107 25
muhammed
Desconectado/a
se unió: 04/13/2013

Maybe I need to change settings online, for my domain name. Should I register the hostname "mail" as a nameserver? I hope that sentence made sense lol.

This is a total shot in the dark ... maybe it's something else?