Skip to main content

sSMTP

sSMTP - Simple SMTP

sSMTP is a simple MTA to deliver mail from a computer to a mail hub (SMTP server). sSMTP is simple and lightweight, there are no daemons or anything hogging up CPU; Just sSMTP. Unlike Exim4, sSMTP does not receive mail, expand aliases, or manage a queue.

Setting up

/etc/ssmtp/ssmtp.conf

# For My SMTP relay server
AuthUser=alang@domain.com
AuthPass=ThisIsPassword
FromLineOverride=YES
mailhub=smtp.domain.com:587
UseSTARTTLS=YES
如何自訂 sender 的位址

修改 /etc/ssmtp/ssmtp.conf

FromLineOverride=NO
root=win.mis03

修改 /etc/ssmtp/revaliases

root:win.mis03@msa.hinet.net
發信測試

方法一: 使用 ssmtp

$> ssmtp alang.hsu@gmail.com

To: alang.hsu@gmail.com
From: sender@domain.com
Subject: Test Mail
Hello, World
<Ctrl-D to Exit>

方法二: 使用 mail

echo "Hello, World" | mail -s "Test Mail"

NOTE:

使用方法一時,From 必須輸入一個有效的郵件地址。

使用方法二有可能會寄不出去,原因是 sender 的郵件地址不是一個有效的位址。參考自訂 sender 位址的步驟。