Logo Questions Linux Laravel Mysql Ubuntu Git Menu
 

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

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.

like image 719
Matt Elhotiby Avatar asked Jan 25 '11 21:01

Matt Elhotiby


People also ask

How can I test my postfix email?

In this step, you'll test whether Postfix can send emails to an external email account using the mail command, which is part of the mailutils package that was installed in Step 1. To send a test email, type: echo "This is the body of the email" | mail -s "This is the subject line" your_email_address.

How do I check postfix mail in Linux?

Postfix configuration. You can run command postconf -n and it will show postfix config in action!

How do I check my postfix configuration?

Check configurationRun the postfix check command. It should output anything that you might have done wrong in a configuration file. To see all of your configs, type postconf . To see how you differ from the defaults, try postconf -n .


2 Answers

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

like image 197
Raghav Rach Avatar answered Sep 25 '22 02:09

Raghav Rach


(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

like image 26
MattC Avatar answered Sep 24 '22 02:09

MattC