Host: CentOS 7,
Install SendMail, start the sendmail, generally can, but some classmates why not, is the start does not move the following situation! So now how to solve.
Yum Install SendMail
Systemctl start sendmail.servicesystemctl status sendmail.service sendmail.service-sendmail Mail Transport Agent Load Ed:loaded (/usr/lib/systemd/system/sendmail.service; enabled; vendor preset:disabled) active:active (running) since S Un 2016-05-08 12:22:58 CST; 1min 33s ago process:9727 execstart=/usr/sbin/sendmail-bd $SENDMAIL _opts $SENDMAIL _optarg (code=exited, Status=0/succe SS) process:9722 execstartpre=/etc/mail/make aliases (code=exited, status=0/success) process:9720 ExecStartPre=/etc/m Ail/make (code=exited, status=0/success) Main pid:9730 (sendmail) CGroup:/system.slice/sendmail.service└─97 Sendmail:accepting connectionmay 12:21:58 Iz28xev9g2sz systemd[1]: Starting sendmail Mail Transport Agent ... May 12:21:58 Iz28xev9g2sz sendmail[9727]: My unqualified host name (IZ28XEV9G2SZ) unknown; Sleeping for Retrymay 12:22:58 Iz28xev9g2sz sendmail[9727]: Unable to qualify my own domain name (iz28xev9g2sz)--Usin G Short Namemay 12:22:58 iz28xEv9g2sz systemd[1]: PID file/run/sendmail.pid not readable (yet?) after start. May 12:22:58 Iz28xev9g2sz sendmail[9730]: Starting daemon (8.14.7): [Email protected]:00:00may 12:22:58 IZ28xe V9g2sz systemd[1]: Started Sendmail Mail Transport Agent.
Workaround: In fact, your host is not set hostname
Mail sends mail, the default call is sendmail,sendmail send mail, you must set hostname, and hostname cannot be a string, but must be a well-formed domain name, such as Mail.tome178.com
So our solution is to modify the hostname, one is temporary, one is permanent.
In general, we can set temporary
Hostname mail.tome178.com
Permanent modification /etc/sysconfig/network
And then run
Hostname mail.tome178.com
And then restart SendMail to send mail.
Sendmail.service-sendmail Mail Transport Agent loaded:loaded (/usr/lib/systemd/system/sendmail.service; enabled; ve Ndor preset:disabled) active:active (running) since Sun 2016-05-08 12:39:48 CST; 16min ago process:9939 execstart=/usr/sbin/sendmail-bd $SENDMAIL _opts $SENDMAIL _optarg (code=exited, status=0/success ) process:9933 Execstartpre=/etc/mail/make aliases (code=exited, status=0/success) process:9932 ExecStartPre=/etc/mai L/make (code=exited, status=0/success) Main pid:9942 (sendmail) CGroup:/system.slice/sendmail.service└─9942 Sendmail:accepting connectionsmay 12:41:12 mail.tome178.com sendmail[9965]: u484fbcq009965:from=<[email Protected]>, si .... 1]may 12:41:13 mail.tome178.com sendmail[9967]: starttls=client, relay=163mx01.mxmail.netease.co ... 256May 12:41:14 mail.tome178.com sendmail[9967]: starttls=client, relay=163mx03.mxmail.netease.co ... 256May 12:41:14 mail.tome178.com sendmail[9967]: U484fbcq009965:to=<[email&nbsP;protected]>, Ctladdr=< 12:41:21 mail.tome178.com sendmail[9971]: u484fkxx009971:from=<[email protected]>, si .... 1]may 12:41:21 mail.tome178.com sendmail[9973]: starttls=client, relay=mx3.qq.com., VERSION=TLSV ... 128May 12:41:24 mail.tome178.com sendmail[9973]: u484fkxx009971:to=<[email protected]>, Ctladdr=<r . s) may 12:54:08 mail.tome178.com sendmail[9988]: u484s8is009988:from=<[email protected]>, si .... 1]may 12:54:09 mail.tome178.com sendmail[9990]: starttls=client, relay=mx3.qq.com., VERSION=TLSV ... 128May 12:54:09 mail.tome178.com sendmail[9990]: u484s8is009988:to=<[email protected]>, Ctladdr=<r ... s) hint:some lines were ellipsized, use-l to show on full.
Linux Learning-mail Send mail (mail cannot send email)