You have to forward smtp mail to your isp's smtp server. You should have a setting in your mail server config for this. But you do have to be careful spammers don't use your smtp server for spam - so you will need to secure your mail server.
Just to get you started, and especially as you indicate it is a learning project, first of all just get your smtp server forwarding to your ISP smtp server. Usually something like mail.ispname.com
Then check you can send.
You can use smtp commands to interact with your mail server.
Example.
telnet 192.168.7.55 25
Trying 192.168.7.55...
Connected to 192.168.7.55.
Escape character is '^]'.
220 yourdomain.com ESMTP (Code-Crafters Ability Mail Server 2.6
HELO yourdomain.com
250 yourdomain.com
MAIL FROM: joe@yourdomain.com
250 Email address accepted. <joe@yourdomain.com>
RCPT TO: joe@gmail.com
250 Email address accepted. <jo@gmail.com>
DATA
354 Please send the data and end with a <CRLF>.<CRLF>.
Hi Guys
.
250 Mail accepted and queued for delivery.
quit
221 Thank you and good bye.
Connection closed by foreign host.
This all assumes you have domain names setup.
for receiving, your smtp server must be accessible from your ISP's smtp server. Usually you also have to specify that you want an smtp mail feed to get smtp mail delivered to your mail server. Usually, for cheap end ISP deals you will only get pop3 mail delivery - where you say my pop3 mail account is joebloggs and they send all mail to joebloggs@theisp.com to that mailbox.
Setting up a mail server, particularly securing it is not trivial.
thanks, i will try to do it as you said, beside this i read about a thing that is blacklisting these kind of mail servers, can you also shed light on this. – Mr.IT – 2015-04-04T05:41:50.907
There is not enough information in your question to comment on that. – user619818 – 2015-04-04T09:30:56.100