Due to restrictions on the company's intranet firewall, the following error occurs when gitlab sends an email to Gmail or another Internet mailbox via Sendmail:
Jul 14 06:48:14 gitlab Sm-MTA [12379]: r6c7hncz024915: To = <mmm@pku.edu.cn>, delay = 1 + 15: 30: 25, xdelay = 00:00:00, Mailer = ESMTP, PRI = 21452479, relay = mx1.pku.edu.cn ., DSN = \ 4.0.0, stat = deferred: Connection timed out with mx1.pku.edu.cn.
The solution is to configure Sendmail so that it can use the company's internal SMTP server to send an email. The configuration is simple. Add a line at the end of the/etc/mail/sendmail. Mc file:
Define ('smart _ host', 'smtp .mycompany.com ')
Then perform a test to create a text file:
To: csfreebird@gmail.comSubject: Test Sendmail in esrifrom: gitlab@mycompany.comtest Gmail
Run the following command:
Root @ gitlab:/OPT # sendmail-Vt </opt/mail.txt
Check the email address and send it successfully.
Now gitlab can send emails to all mailboxes without interruption.