unable to view postfix email from centos 7 command line, why not?

CodeMed

I have postfix installed on a development box and I used the parameters from this other posting to configure postfix to work on localhost only. But the other posting does not explain how to send emails or view received emails from the command line. I have higher level code for sending/receiving smtp email, but I want to be able to do it from the command line first in order to validate the postfix is working before I start testing the higher level code. I have made several tries and seem to be sending emails, but I cannot find the emails that have been sent. How can I confirm that the emails have been sent and also read the emails from the command line?

EDIT#1:

I typed MAIL=/home/root/Maildir in the terminal then hit return, then typed mail and hit return. I did this in the root account and again in the username account. This showed a list of old emails in the root account, so I logged into the username account and typed the following to send an email from username to root:

sendmail root@localhost <<EOF
subject:This is a test
from:username@localhost
Body message here...
EOF

The preceding code resulted in another command prompt with no error. But when I logged back into root and typed mail again to check mail, the new email was not listed along with the old emails.

Also, main.cf is as follows:

queue_directory = /var/spool/postfix
command_directory = /usr/sbin
daemon_directory = /usr/libexec/postfix
data_directory = /var/lib/postfix
mail_owner = postfix
myorigin = localhost
inet_interfaces = localhost
inet_protocols = all
unknown_local_recipient_reject_code = 550
mynetworks = 127.0.0.0/8 [::ffff:127.0.0.0]/104 [::1]/128
relayhost = 
alias_maps = hash:/etc/aliases
alias_database = hash:/etc/aliases
home_mailbox = Maildir/
mailbox_command = 
debug_peer_level = 2
debugger_command =
    PATH=/bin:/usr/bin:/usr/local/bin:/usr/X11R6/bin
    ddd $daemon_directory/$process_name $process_id & sleep 5
sendmail_path = /usr/sbin/sendmail.postfix
newaliases_path = /usr/bin/newaliases.postfix
mailq_path = /usr/bin/mailq.postfix
setgid_group = postdrop
html_directory = no
manpage_directory = /usr/share/man
sample_directory = /usr/share/doc/postfix-2.10.1/samples
readme_directory = /usr/share/doc/postfix-2.10.1/README_FILES

What am I doing wrong?

EDIT#2:

After IanMcGowan's suggestions, I checked to see that mailx was already installed. I then used this tutorial to test sending and receiving emails using the mailx commands, but I am not able to read the newly send emails either. I think it is a configuration problem. I am using email addresses like root@localhost and username@localhost.

telnet localhost 25 results in:

Trying 127.0.0.1...
Connected to localhost.
Escape character is '^]'.
220 localhost.localdomain ESMTP Postfix

nano /var/log/maillog contains:

Jan  5 12:09:40 localhost postfix/postfix-script[6162]: starting the Postfix mail system
Jan  5 12:09:40 localhost postfix/master[6164]: daemon started -- version 2.10.1, configuration /etc/postfix
Jan  5 12:46:00 localhost postfix/postfix-script[3036]: starting the Postfix mail system
Jan  5 12:46:00 localhost postfix/master[3047]: daemon started -- version 2.10.1, configuration /etc/postfix
Jan  5 13:12:02 localhost postfix/smtpd[4642]: connect from localhost.localdomain[127.0.0.1]
Jan  5 13:12:02 localhost postfix/smtpd[4642]: DB1249A618: client=localhost.localdomain[127.0.0.1]
Jan  5 13:12:02 localhost postfix/cleanup[4645]: DB1249A618: message-id=<1738078707.0.1420492322780.JavaMail.username@localhost.localdomain>
Jan  5 13:12:02 localhost postfix/qmgr[3058]: DB1249A618: from=<[email protected]>, size=632, nrcpt=1 (queue active)
Jan  5 13:12:02 localhost postfix/smtpd[4642]: disconnect from localhost.localdomain[127.0.0.1]
Jan  5 13:12:02 localhost postfix/local[4646]: DB1249A618: to=<[email protected]>, orig_to=<root@localhost>, relay=local, delay=0.11, delays=0.06/0.02/0/0.03, dsn=2.0.0, status=sent (delivered to maildir)
Jan  5 13:12:02 localhost postfix/qmgr[3058]: DB1249A618: removed
Jan  5 14:29:20 localhost postfix/pickup[5207]: 7F4439A616: uid=1000 from=<username>
Jan  5 14:29:20 localhost postfix/cleanup[5266]: 7F4439A616: message-id=<[email protected]>
Jan  5 14:29:20 localhost postfix/qmgr[3058]: 7F4439A616: from=<[email protected]>, size=334, nrcpt=1 (queue active)
Jan  5 14:29:20 localhost postfix/local[5271]: 7F4439A616: to=<[email protected]>, orig_to=<root@localhost>, relay=local, delay=0.13, delays=0.1/0.01/0/0.02, dsn=2.0.0, status=sent (delivered to maildir)
Jan  5 14:29:20 localhost postfix/qmgr[3058]: 7F4439A616: removed
Jan  5 14:57:10 localhost postfix/pickup[5207]: A21B49A618: uid=0 from=<root>
Jan  5 14:57:10 localhost postfix/cleanup[5529]: A21B49A618: message-id=<[email protected]>
Jan  5 14:57:10 localhost postfix/qmgr[3058]: A21B49A618: from=<[email protected]>, size=534, nrcpt=1 (queue active)
Jan  5 14:57:10 localhost postfix/local[5531]: A21B49A618: to=<[email protected]>, orig_to=<root>, relay=local, delay=0.38, delays=0.34/0.01/0/0.03, dsn=2.0.0, status=sent (delivered to maildir)
Jan  5 14:57:10 localhost postfix/qmgr[3058]: A21B49A618: removed
Jan  5 15:47:38 localhost postfix/pickup[5207]: F312D9A618: uid=0 from=<root>
Jan  5 15:47:39 localhost postfix/cleanup[5975]: F312D9A618: message-id=<[email protected]>
Jan  5 15:47:39 localhost postfix/qmgr[3058]: F312D9A618: from=<[email protected]>, size=458, nrcpt=1 (queue active)
Jan  5 15:47:39 localhost postfix/local[5977]: F312D9A618: to=<[email protected]>, orig_to=<username@localhost>, relay=local, delay=0.12, delays=0.09/0.01/0/0.03, dsn=2.0.0, status=sent (delivered to maildir)
Jan  5 15:47:39 localhost postfix/qmgr[3058]: F312D9A618: removed
Jan  5 15:48:20 localhost postfix/pickup[5207]: A826C9A618: uid=1000 from=<username>
Jan  5 15:48:20 localhost postfix/cleanup[5975]: A826C9A618: message-id=<[email protected]>
Jan  5 15:48:20 localhost postfix/qmgr[3058]: A826C9A618: from=<[email protected]>, size=461, nrcpt=1 (queue active)
Jan  5 15:48:20 localhost postfix/local[5977]: A826C9A618: to=<[email protected]>, orig_to=<username@localhost>, relay=local, delay=0.11, delays=0.08/0/0/0.03, dsn=2.0.0, status=sent (delivered to maildir)
Jan  5 15:48:20 localhost postfix/qmgr[3058]: A826C9A618: removed
Jan  5 15:48:29 localhost postfix/pickup[5207]: 54AA19A618: uid=1000 from=<username>
Jan  5 15:48:29 localhost postfix/cleanup[5975]: 54AA19A618: message-id=<[email protected]>
Jan  5 15:48:29 localhost postfix/qmgr[3058]: 54AA19A618: from=<[email protected]>, size=461, nrcpt=1 (queue active)
Jan  5 15:48:29 localhost postfix/local[5977]: 54AA19A618: to=<[email protected]>, orig_to=<root@localhost>, relay=local, delay=0.11, delays=0.09/0/0/0.02, dsn=2.0.0, status=sent (delivered to maildir)
Jan  5 15:48:29 localhost postfix/qmgr[3058]: 54AA19A618: removed
Jan  5 15:52:03 localhost postfix/pickup[5207]: C756E9A618: uid=0 from=<root>
Jan  5 15:52:03 localhost postfix/cleanup[6074]: C756E9A618: message-id=<[email protected]>
Jan  5 15:52:03 localhost postfix/qmgr[3058]: C756E9A618: from=<[email protected]>, size=491, nrcpt=1 (queue active)
Jan  5 15:52:03 localhost postfix/local[6076]: C756E9A618: to=<[email protected]>, orig_to=<root@localhost>, relay=local, delay=0.13, delays=0.09/0.01/0/0.03, dsn=2.0.0, status=sent (delivered to maildir)
Jan  5 15:52:03 localhost postfix/qmgr[3058]: C756E9A618: removed
Jan  5 16:02:36 localhost postfix/smtpd[6213]: connect from localhost.localdomain[127.0.0.1]
Jan  5 16:04:26 localhost postfix/smtpd[6213]: disconnect from localhost.localdomain[127.0.0.1]  

The logs say delivered to maildir. Am I using the wrong syntax to access maildir contents? If so, what is the correct syntax? Or is the problem in main.cf above?

EDIT#3

I typed nano /var/spool/mail/root and was able to view the old emails that show up when I log in as root and type mail or mailx. But the new emails are not located there. These emails are automated and seem to be relics from before postfix was configured to use /Maildir structure.

garethTheRed

Unless you have a specific requirement to move your mail store; simply restore the configuration to the defaults.

That setup stores your emails in /var/spool/mail/<username> instead of your home which means any MUA you install will know where to find it without any reconfiguration.

Collected from the Internet

Please contact [email protected] to delete if infringement.

edited at
0

Comments

0 comments
Login to comment

Related

From Dev

How to send email with attachment by postfix from command-line?

From Dev

Newly installed CentOS 7 boots to command line and unable to enter GUI

From Dev

VirtualBox CentOS 7 installation- why just command line, no desktop?

From Dev

CentOS 7 how to stop / start Gnome desktop from command line

From Dev

CentOS 7 how to stop / start Gnome desktop from command line

From Dev

Does postfix using mail command report if an email was unable to be sent to an address?

From Dev

How to read email from command line in linux?

From Dev

use 'mail' to read email from command line

From Dev

In CentOS7 how to allow email address with adduser command?

From Dev

Unable to send a email through the command line on (Ubuntu Desktop)

From Dev

How do I mount Nexus 7 to view files from command line

From Dev

postfix: unable to Telnet into port 25 on centos 6.7

From Dev

Unable to run testng from command line

From Dev

Unable to run testng from command line

From Dev

How to change language using command line on CentOS 7?

From Dev

Configure Gnome Desktop for CentOS 7 Using Command Line for Vagrant

From Dev

View deployment history from the command line or PowerShell

From Dev

how to view a doc from command line?

From Dev

how to view a doc from command line?

From Dev

View deployment history from the command line or PowerShell

From Dev

ACL/MAC Permissions for dovecot and postfix in CentOS 7

From Dev

ACL/MAC Permissions for dovecot and postfix in CentOS 7

From Dev

Postfix and Apache: Permission denied on CentOS 7

From Dev

Printing from Windows 7 command line

From Dev

7-Zip and unzipping from command line

From Dev

mongodb not starting from command line in Windows 7

From Dev

How can I email an attachment from the command line

From Dev

How to replace an email in a (PHP) file from the command line without sed?

From Dev

How can I email an attachment from the command line

Related Related

  1. 1

    How to send email with attachment by postfix from command-line?

  2. 2

    Newly installed CentOS 7 boots to command line and unable to enter GUI

  3. 3

    VirtualBox CentOS 7 installation- why just command line, no desktop?

  4. 4

    CentOS 7 how to stop / start Gnome desktop from command line

  5. 5

    CentOS 7 how to stop / start Gnome desktop from command line

  6. 6

    Does postfix using mail command report if an email was unable to be sent to an address?

  7. 7

    How to read email from command line in linux?

  8. 8

    use 'mail' to read email from command line

  9. 9

    In CentOS7 how to allow email address with adduser command?

  10. 10

    Unable to send a email through the command line on (Ubuntu Desktop)

  11. 11

    How do I mount Nexus 7 to view files from command line

  12. 12

    postfix: unable to Telnet into port 25 on centos 6.7

  13. 13

    Unable to run testng from command line

  14. 14

    Unable to run testng from command line

  15. 15

    How to change language using command line on CentOS 7?

  16. 16

    Configure Gnome Desktop for CentOS 7 Using Command Line for Vagrant

  17. 17

    View deployment history from the command line or PowerShell

  18. 18

    how to view a doc from command line?

  19. 19

    how to view a doc from command line?

  20. 20

    View deployment history from the command line or PowerShell

  21. 21

    ACL/MAC Permissions for dovecot and postfix in CentOS 7

  22. 22

    ACL/MAC Permissions for dovecot and postfix in CentOS 7

  23. 23

    Postfix and Apache: Permission denied on CentOS 7

  24. 24

    Printing from Windows 7 command line

  25. 25

    7-Zip and unzipping from command line

  26. 26

    mongodb not starting from command line in Windows 7

  27. 27

    How can I email an attachment from the command line

  28. 28

    How to replace an email in a (PHP) file from the command line without sed?

  29. 29

    How can I email an attachment from the command line

HotTag

Archive