서버마다 메일서버를 구축하는 것 보다 ssmtp로 설정하고 하나의 smtp 서버에 연결해서 사용하는것이 더 낫다.
소스 : http://packages.debian.org/source/sid/ssmtp
ssmtp 2.64
wget http://ftp.de.debian.org/debian/pool/main/s/ssmtp/ssmtp_2.64.orig.tar.bz2 tar xvfj ssmtp_2.64.orig.tar.bz2 cd ssmtp-2.64 ./configure --sysconfdir=/etc make; make install
ssmtp 2.62
wget http://ftp.de.debian.org/debian/pool/main/s/ssmtp/ssmtp_2.62.orig.tar.gz wget http://ftp.de.debian.org/debian/pool/main/s/ssmtp/ssmtp_2.62-3.diff.gz tar xvfz ssmtp_2.62.orig.tar.gz gunzip ssmtp_2.62-3.diff.gz mv ssmtp-2.62 ssmtp patch -p0 < ssmtp_2.62-3.diff mv ssmtp ssmtp-2.62 cd ssmtp-2.62/ssmtp ./configure --sysconfdir=/etc make; make install
sendmail을 대치해야 한다. 만일 sendmail을 지우지 않았다면 다음과 같이 대치 한다.
아니면 /etc/alternatives 가서 mta관련 링크를 수정해야 한다. (근데 sendmail 지워주고 깔면 알아서 셋팅된다.) 참조 : http://linux.com/archive/feature/132006
sudo mv /usr/sbin/sendmail /usr/sbin/sendmail.orig sudo ln -s /usr/local/sbin/ssmtp /usr/sbin/sendmail
vi /etc/ssmtp/ssmtp.conf # # /etc/ssmtp.conf -- a config file for sSMTP sendmail. # # The person who gets all mail for userids < 1000 # Make this empty to disable rewriting. root=postmaster # The place where the mail goes. The actual machine name is required # no MX records are consulted. Commonly mailhosts are named mail.domain.com # The example will fit if you are in domain.com and you mailhub is so named. mailhub=mail # 바꾸려는 메일서버 주소 # Where will the mail seem to come from? #rewriteDomain= # The full hostname hostname=localhost # 서버 hostname fromlineoverride=yes # php등에서 메일 보낼때 from을 오버라이딩 가능하게
gmail서버로도 연결이 가능하니 꼭 메일 서버를 가지지 않아도 될듯 하다.
Using SSMTP to Replace Sendmail (Gmail Config)