Join 1M+ other developers and:
- Get help and share knowledge in Q&A
- Subscribe to topics of interest
- Get courses & tools that help you grow as a developer or small business owner
Why can't send mail with command mail or mailx?
I have installed postfix and start postfix service .
I can send email from user root to user debian8 by telnet command.
root@pengsir:/home/debian8# telnet localhost 25 Trying ::1... Connected to localhost. Escape character is '^]'. 220 pengsir.hfi ESMTP Postfix (Debian/GNU) ehlo mail 250-pengsir.hfi 250-PIPELINING 250-SIZE 10240000 250-VRFY 250-ETRN 250-STARTTLS 250-ENHANCEDSTATUSCODES 250-8BITMIME 250 DSN mail from:<root> 250 2.1.0 Ok rcpt to:<debian8> 250 2.1.5 Ok data 354 End data with <CR><LF>.<CR><LF> this is a test mail send from root . 250 2.0.0 Ok: queued as CA53CF82C3 quit 221 2.0.0 Bye Connection closed by foreign host.
Let’s change user debian8 to receive the email.
root@pengsir:/home/debian8# su debian8 debian8@pengsir:~$ mail Mail version 8.1.2 01/15/2001. Type ? for help. "/var/mail/debian8": 1 messages 1 new 1 unread N 1 email@example.com Wed Aug 19 10:10 13/441 & 1 Message 1: From firstname.lastname@example.org Wed Aug 19 10:10:56 2015 X-Original-To: debian8 Date: Wed, 19 Aug 2015 10:10:23 +0800 (HKT) From: email@example.com this is a test mail send from root & quit
It is strange that i can not send email with
mail -s 'test_for_postfix' firstname.lastname@example.org mailx -s 'test_for_postfix' email@example.com
It look like that the cursor will be stop in the console forever ,no error info putput when to execute the two commands.
These answers are provided by our Community. If you find them useful, show some love by clicking the heart. If you run into issues leave a comment, or add your own answer to help others.×