Environment: ubuntu12.04
I. Install software
Apt-get install sendmail
Apt-get install sendmail-cf (This software has been installed in the previous step)
Apt-get install mailutils
Check whether the installation is successful: Enter ps aux | grep sendmail on the terminal.
Root 23905 0.0 0.2 15104 2240? Ss sendmail: MTA: accepting connections
Hadoop 26100 0.0 0.0 4368 828 pts/2 S + grep -- color = au
To sendmail
Sendmail is successfully started.
Ii. Configuration
Vi/etc/mail/sendmail. mc
Modify: DAEMON_OPTIONS ('family = inet, Name = MTA-v4, Port = smtp, Addr = 0.0.0.0) dnl
Generate a new configuration file:
Cd/etc/mail
Mv sendmail. cf sendmail. cf ~ Backup
M4 sendmail. mc> sendmail. cf
3. Send email
Here I used a QQ mailbox, which is too pitfall.
Echo "body" | mail-s subject 12345@qq.com
No email was received. View/var/log/syslog and find DSN: Service unavailable. The domain name is incorrect on the network. Modify the host name.
Solution is to modify the/etc/hosts inside the first line: 127.0.0.1 gitlab.youdomain.com localhost ubuntu1204-dell #127.0.0.1 localhost. localdomain localhost ubuntu1204-dell do not restart, and then observe/var/logs/syslog log, the problem is solved, I did not solve here, and then modified the Host Name and hosts corresponding, the error is the same after restart, but relay = mx3.qq.com is found. [183.62.125.199]. It indicates that the email has been sent but is returned. You can only change it to the 163 email address.