Postfix is installed but how do I test it? [closed]
Asked Answered
L

2

29

I tried everything, I read online to test, and I can't get email to go out:

telnet <IP> 25
EHLO
MAIL FROM: <from-email>
RCPT TO: <recipient-email>
DATA
Type message here.
. <Enter>
=>

I even tried this, and when I type the period, I get nothing - but postfix is installed.

Lepper answered 25/1, 2011 at 21:2 Comment(1)
this post shows how to quickly setup postfix with gmail smtp port 587 and test it, and how to set your own email to receive all mail to root: unix.stackexchange.com/a/731560/346155Irmairme
V
54

To check whether postfix is running or not

sudo postfix status

If it is not running, start it.

sudo postfix start

Then telnet to localhost port 25 to test the email id

ehlo localhost
mail from: root@localhost
rcpt to: your_email_id
data
Subject: My first mail on Postfix

Hi,
Are you there?
regards,
Admin
.

Do not forget the . at the end, which indicates end of line

Vanessa answered 6/5, 2013 at 7:14 Comment(1)
@PJBrunet Yes, You can still check the status of the postfix using the status command as given in answerVanessa
F
18

(I just got this working, with my main issue being that I don't have a real internet hostname, so answering this question in case it helps someone)

You need to specify a hostname with HELO. Even so, you should get an error, so Postfix is probably not running.

Also, the => is not a command. The '.' on a single line without any text around it is what tells Postfix that the entry is complete. Here are the entries I used:

telnet localhost 25
(says connected)
EHLO howdy.com
(returns a bunch of 250 codes)
MAIL FROM: [email protected]
RCPT TO: (use a real email address you want to send to)
DATA (type whatever you want on muliple lines)
. (this on a single line tells Postfix that the DATA is complete)

You should get a response like:

250 2.0.0 Ok: queued as 6E414C4643A

The email will probably end up in a junk folder. If it is not showing up, then you probably need to setup the 'Postfix on hosts without a real Internet hostname'. Here is the breakdown on how I completed that step on my Ubuntu box:

sudo vim /etc/postfix/main.cf
smtp_generic_maps = hash:/etc/postfix/generic (add this line somewhere)
(edit or create the file 'generic' if it doesn't exist)
sudo vim /etc/postfix/generic
(add these lines, I don't think it matters what names you use, at least to test)
[email protected]             [email protected]
[email protected]             [email protected]
@localdomain.local                [email protected]
then run:
postmap /etc/postfix/generic (this needs to be run whenever you change the 
generic file)

Happy Trails

Froehlich answered 29/4, 2013 at 17:46 Comment(1)
You have to specify emails in angle brackets, in other case it won't work MAIL FROM: <[email protected]>Beebread

© 2022 - 2024 — McMap. All rights reserved.