debian 傳送郵件 配置記錄

2021-09-24 06:19:00 字數 1533 閱讀 2297

apt-get install bsd-mailx

apt-get install sendmail

vim /etc/mail.rc

set from=***[email protected]

set smtp=smtp.126.com

set [email protected]

set smtp-auth-password=***

set smtp-auth=login

vim /etc/hosts

借鑑:

sendmail[20475]: unable to qualify my own domain name (ajkhuel) -- using short name

於是,google了一下,發現是/etc/hosts檔案的問題:

原檔案內容:

127.0.0.1localhost

::1 localhostlocalhost.localdomain localhost6 localhost6.localdomain6

192.168.8.66 ajkhuel

修改後內容:

127.0.0.1localhost

::1 localhostlocalhost.localdomain localhost6 localhost6.localdomain6

192.168.8.66 ajkhuel abc.mail.com

修改後,重啟sendmail服務,郵件傳送成功。

noqueue: syserr(root): opendaemonsocket: daemon mta-v4: cannot bind: address already in use

sm-mta[15373]: daemon mta-v4: problem creating smtp socket

...

vim /etc/mail/access

新增郵箱relay

vim /etc/mail/sendmail.mc

dnl daemon_options(`port=smtp,addr=127.0.0.1, name=mta')dnl

將前面的dnl去掉,修改為如下:

daemon_options(`port=smtp,addr=0.0.0.0, name=mta')dnl

m4 /etc/mail/sendmail.mc > /etc/mail/sendmail.cf

/etc/init.d/sendmail restart

systemctl restart sendmail

systemctl start sendmail

systemctl stop sendmail

systemctl status sendmail

echo "  yes , so good " | mail -s " this is test mail " [email protected]

apt-get install -y msmtp

Mnatis傳送郵件配置

1 php配置 郵件伺服器配置 在php.ini檔案中查詢smtp,將localhost改為你的發件伺服器,smtp ip ip為伺服器的ip位址 在php.ini檔案中查詢sendmail from,將前面的分號去掉,並在後面填上郵件位址 2 mantis配置 在mantis的config inc...

gitlab傳送郵件配置

1.修改gitlab的配置檔案 vim etc gitlab gitlab.rb,找到如下圖所示的部分,放開注釋,修改配置,此處我用的發件郵箱是qq郵箱,所以網域名稱配置都是qq.com,如果用的是163或者gmail郵箱等等,更改對應配置即可 文字部分說明 gitlab rails smtp en...

Django傳送郵件配置

email backend django.core.mail.backends.smtp.emailbackend email use tls false email use ssl false email host smtp.163.com email port 25email host user...