A simple SMTP mail server, a tiny but complete realization of smtp protocol.
- OS: only for Linux/Unix plantform
- Multithread: create a thread for each client's request
- Authentication: store username and passwd to a file
- Base64 encode and decode
- Get the source
git clone https://github.com/ibillxia/xsmtp.git
cd xsmtp
- Edit Config Set the user data storage directory:
vim conf.h
Set the variable data_dir
to /home/YourName/data
.
- Add files and user account
cd /home/YourName/
mkdir data
vim userinfo
#add two users in this file
#[email protected]
#[email protected]
#then write and quit
touch userstat
- Send Mail Example Run the executable file in one terminal:
sudo xsmtp
This started the mail server. And now you can send e-mail to the server in another terminal like this:
telnet localhost 25
S: 220 Ready
C: HELO
S: 250 OK
C: MAIL FROM:<[email protected]>
S: 250 OK
C: RCPT TO:<[email protected]>
S: 250 OK
C: DATA
S: 354 Send from Rising mail proxy
C: Hello Alice. This is a test message.<CR><LF>.<CR><LF>
S: 250 OK
C: QUIT
S: 221 Bye
Well done!
This program is a simple mail dispatcher via smtp protocol. It runs only on Linux/Unix plantforms.
For more about SMTP, please refer to wiki and it's RFC documents:
wiki: Simple_Mail_Transfer_Protocol
RFC 5321 โ The Simple Mail Transfer Protocol
The MIT License (MIT) Copyright (C) 2011-2014 Bill Xia ([email protected]) All rights reserved.