POSTFIX 설치


POSTFIX 설치




최초 작성일 : 2022-03-12 | 수정일 : 2022-03-12 | 조회수 : 763


POSTFIX 설치

In this post, I would like to share how to install mail server on Mac OSX. Having mail server is important if you need to send email from your web application in local environment. To do this, we will use Postfix.

Postfix is a Mail Transport Agent (MTA), supporting LDAP, SMTP AUTH (SASL) and TLS. In this post, We will setup Postfix to run with SMTP.

Setup

  • Mac OSX (I'm using OSX Yosemite 10.10.3).
  • Terminal

Postfix Installation

No need it because Postfix already exist as pre-installed on Mac OSX. Open your terminal, make sure you can see response if you type below:

$ postfix
postfix: error: to submit mail, use the Postfix sendmail command
postfix: fatal: the postfix command is reserved for the superuser

Great, then we are going to configure it to be able for sending email.

Postfix Configuration

We are going to change postfix configuration file. Run this command below:

$ sudo vi /etc/postfix/main.cf

Make sure if these lines below are exist

mail_owner = _postfix
setgid_group = _postdrop

Then, add these lines at the end of file

# Use Gmail SMTP
relayhost = smtp.gmail.com:587
smtp_sasl_mechanism_filter = plain
smtp_sasl_auth_enable = yes
smtp_sasl_password_maps = hash:/etc/postfix/sasl_passwd
smtp_use_tls = yes
smtp_tls_security_level = encrypt
tls_random_source = dev:/dev/urandom

From codes above, you can see that we use Gmail SMTP for our postfix. Next step is add our gmail's username and password.

$ sudo vim /etc/postfix/sasl_passwd

and add this line

smtp.gmail.com:587 your_username@gmail.com:your_password

Then run command below to create the hash db file for Postfix.

$ sudo postmap /etc/postfix/sasl_passwd

Configure the postfix daemon

$ sudo vi /System/Library/LaunchDaemons/org.postfix.master.plist

Add these lines before </dict>

RunAtLoad

KeepAlive

Start the postfix service

$ sudo postfix start

* Note that if you make changes in postfix configuration file (/etc/postfix/main.cf), you have to run command

$ sudo postfix reload

Testing

Here is the command you need to execute to test postfix.

$ echo "Test sending email from Postfix" | mail -s "Test Postfix" youremail@domain.com

If success, you will receive email in your inbox.

If you want to see mail queues, execute this command

$ mailq

If you want to see mail log, execute this command

$ tail -f /var/log/mail.log

Conclusion

Setting up mail server on Mac OSX can be done using pre-installed Postfix. Having mail server in local environment will give you advantage for your web application that have sending email feature.

Tags  #POSTFIX  

닉네임:
댓글내용:
🚀 추천글
새글

애플컴퓨터 신제품, 2025년 출시될 최신 정보 총정리!
2025-08-23
  • 애플컴퓨터
  • 애플 신제품
  • 2025년 출시
애플컴퓨터 신제품, 2025년 기대작 총정리!
2025-08-22
  • 애플컴퓨터
  • 2025년 신제품
  • 맥북 프로
애플컴퓨터 신제품, 2025년 최신 소식 총정리!
2025-08-21
  • 애플컴퓨터
  • 2025년 신제품
  • 아이폰 17
애플컴퓨터 최신 소식: M4 칩 성능 폭발! 🚀
2025-08-20
  • M4 칩
  • 애플 M4
  • 애플 신제품
애플컴퓨터 최신 M5 칩 성능 '깜짝'!
2025-08-20
  • 애플 M5 칩
  • M5 칩 성능
  • 애플 실리콘
추천글
카슈미르, 전쟁의 불씨: 국제적 긴장의 중심에서의 갈등 분석
2025-08-20
  • 카슈미르분쟁
  • 인도파키스탄
  • 카르길전쟁




📸 이미지 프롬프트 복사 완료!
이제 어떤 이미지 생성 도구로 이동하시겠어요?
🧠 ImageFX 🧪 Whisk