SMTP Server Project Details
SMTP Server Project Details
Objectives:
Main objective of this project to develop concurrent SMTP server daemon.
Allowed Libraries:
• Standart POSIX socket library.
• Ini parser, https://github.com/ndevilla/iniparser
Project Details:
1) Server should bind (listen) port that defined in application configuration file. This port
uses for command exchange and data transfer purpose. All data exchange should use TCP
transport layer protocol for reliability.
2) Server must have a configuration file (.ini file). This file includes configuration
parameters of server. Configuration file example given in Appendix section (server.ini).
In mail transactions;
MAIL FROM
RCPT TO:
DATA
RSET
NOOP
In closure;
QUIT
Should implement.
Requirements
1) When client first connected to server, server should send greeting message (defined in
server.ini as ServerName) to client.
2) After client sent sender domain with HELO request server should check if this domain is
allowed to access to server from ban_domain.cfg. If domain not listed in this file server
pass next step if it’s listed it should give error message and close connection.
3) Client sends MAIL FROM to server. In this case server should check if sender email
allowed sending mail to server from ban_email.cfg file. If email not listed in this file
server pass next step if it’s listed it should give error message and close connection.
4) Client sends RCPT TO to server. In this case server should check for domain name
(defined in server.ini as DomainName) and if this user listed in users section of server.ini
file. If domain name is matched and user listed in server.ini file pass next step; if it’s user
not listed or domain not correct it should give error message and may wait other user e-
mail address.
5) Client sends DATA command to server. Server should give response code (Ex: 354 )
then client should put line by line mail messages that given to client input. Server get all
message until to reach find mail end command “.”. Then server should save mail message
into user mailbox (defined server.ini) with name YearMonthDayHoutMinSec.mbox
format (Ex: 20110510231101.mbox). Saved file should looks following format:
Return-Path: <[email protected] >
Received: from host.ciu.edu.tr ([212.175.150.10])
by db.ciu.edu.tr with SMTP
for < [email protected] >
To: [email protected]
Subject: This is test message for SMTP server
From: Example Sender< [email protected] >
Date: Thu, 12 Dec 2019 21:03:26 +0200
Assume that mail send to [email protected]. So this mail should put in to following location:
/data/home/20110500/smtp/bob/201912121119.mbox
APPENDIX
server.ini:
-----------------------------------------------------------------------------------------------------------------
# This is SMTP server configuration file. Its have several attributes.
# The lines begin with # accepted as comment line.
# Start for server section
[server]
# ListenIp defines listen ip address of application
ListenIp=All ; If its defined as All its listen all ip address or if defined ip address its only listen this ip
address
# ListenPort defines listening port of application
ListenPort=25
[users]
joe=/joemaildir
jane=/janemaildir
bob=/bobmaildir
#end file
ban_domain.cfg
spammer.com
pirate.com
ban_email.cfg
[email protected]
[email protected]