此時收件箱位址[email protected],那麼如何修改發件箱位址呢?
方法1:使用sendmail的參數f,在參數f後指定發件箱。
此時測試,你就會發現發件箱位址為[email protected],當然這裡你可以對發件位址進行任意設定。這個是最好、最快捷的方法。
方法2:修改sendmail.cf配置檔案
![](https://img.laitimes.com/img/_0nNw4CM6IyYiwiM6ICdiwiIn5GcuImZiFjZ4YGOmhTN4cDN0YzMzYDO5YGZ1czNjFDZ3UWOfdWbp9CXt92Yu4GZjlGbh5SZslmZxl3Lc9CX6MHc0RHaiojIsJye.png)
我們需要修改sendmail.mc中5個地方,如上截圖所示, dnl表示選項被注釋, 我們需要取消4處注釋,注釋掉一處地方
MASQUERADE_AS(<b>domain.com</b>)dnl
FEATURE(masquerade_envelope)dnl
FEATURE(masquerade_entire_domain)dnl
MASQUERADE_DOMAIN(<b>domain.com</b>)dnl
dnl EXPOSED_USER(`root')dnl
MASQUERADE_AS(`mydba.com')dnl
dnl #
dnl # masquerade not just the headers, but the envelope as well
dnl # masquerade not just @mydomainalias.com, but @*.mydomainalias.com as well
dnl MASQUERADE_DOMAIN(localhost)dnl
dnl MASQUERADE_DOMAIN(localhost.localdomain)dnl
dnl MASQUERADE_DOMAIN(mydomainalias.com)dnl
MASQUERADE_DOMAIN(mydba.com)dnl
MAILER(smtp)dnl
出現上面錯誤,是因為沒有安裝sendmail-cf元件,安裝了sendmail-cf元件後,就不會出現上面錯誤
一般是配置/etc/mail/sendmail.mc檔案,然後通過上面指令生成sendmail.cf檔案,但是要注意,不要将之前的一些配置資訊給覆寫了,例如SMTP伺服器等。另外,重新生成配置檔案後必須重新開機sendmail服務,否則配置不會生效
此時在不指定發件人位址的時候,發件人位址為[email protected] 或 [email protected] 。 郵件字首為目前使用者名.
3:修改主機名,主機名和sendmail的發送郵件有關
這個方法其實在實際環境中很少使用。畢竟修改主機名是一件非常麻煩的事情。
網上還有其它一些方法,但是我測試過多次都沒有成功,是以不在此羅列,有興趣的可以自行研究!