ctrl + D不能在邮件中工作

我正在尝试testing我的服务器的邮件function。 我只是做这个mail -s "This is a test" [email protected] ,然后它提示我为Cc:然后正文。 input后,我正在打Control + D,但它似乎不是在身体内退出。 我在这里错过了什么?

您可以用一行发送邮件

echo "This is the mail body" | mail -s "This is the subject" [email protected]

而不需要进一步的打字。

这可能是由于mailconfiguration不当造成的。

要了解问题,请打开debugging机制,例如:

 $mail -s "test" [email protected] --debug-level=3 Cc: Hello. This is a test. . .(doesn't work until Ctrl+D, I'm using mailutils package) . sendmail (/usr/sbin/sendmailn source=system, name=user, passwd=x, uid=1000, gid=1000, gecos=,,,, dir=/home/user, shell=/bin/bash, mailbox=/var/mail/user, quota=0, change_uid=1 source=system, name=user, passwd=x, uid=1000, gid=1000, gecos=,,,, dir=/home/user, shell=/bin/bash, mailbox=/var/mail/user, quota=0, change_uid=1 mu_mailer_send_message(): using From: user@example Sending headers... Sending body... ^C 

(注意错误configuration的用户@例子)

所以这个过程停止发送主体。 您也可以检查/var/log/mail.{err,log} 。 要正确configurationsmtp,请参阅这个 。