🔒 Locked
Server Programming
Advertisement
Original Post
Hi,
I''m interested in learning how to program a simple SMTP server. I''ve read all the RFC''s on SMTP, POP3 and the like, searched the net but not found anything that details exactly what the server does.
I''ve also programmed a multiuser email client for the Macintosh which I believe should help.
After obtaining the email from the user what does the server do with the email?
Can anyone point me in the right direction for information on this as I can''t find anything on programming an actual SMTP server.
I know this doesnt have much to do with gamedev but I don''t know anywhere else to ask.
Regards,
David Stubbs
Yeah. I reckon the sendmai source will be massive...
Just the outline of what needs doing.
Regards,
David Stubbs
Just the outline of what needs doing.
Regards,
David Stubbs
Wow. I just finished making one of these servers in VB
I''ll go into detail here. Remember, I just barely got hold of the concept a while ago 
Instructions for sending to another server
To mail to say, God@gdnmail.net, from Liquid@gdnmail.net you would do this:
connect to gdnmail.net at port 25
once you''re connected, wait for it to send it''s welcome data stuff
Send "HELO gdnmail.net\r\n"
Send "MAIL FROM:\r\n"
Send "RCPT TO:\r\n"
Send "Data\r\n"
Send "Subject: This is the subject\r\n"
Send "This is a test of the Data\r\n"
Send ".\r\n"
Send "QUIT\r\n"
Disconnect
Note: When you send the period and and the Cr+Lf, then that''s the message.
Lemme check my pop3 source code and I''ll get back to that.
---------------------------
"communists eat little kids." -The Alchemist
Instructions for sending to another server
To mail to say, God@gdnmail.net, from Liquid@gdnmail.net you would do this:
connect to gdnmail.net at port 25
once you''re connected, wait for it to send it''s welcome data stuff
Send "HELO gdnmail.net\r\n"
Send "MAIL FROM:
Send "RCPT TO:
Send "Data\r\n"
Send "Subject: This is the subject\r\n"
Send "This is a test of the Data\r\n"
Send ".\r\n"
Send "QUIT\r\n"
Disconnect
Note: When you send the period and and the Cr+Lf, then that''s the message.
Lemme check my pop3 source code and I''ll get back to that.
---------------------------
"communists eat little kids." -The Alchemist
Sorry nes, you got the wrong idea. I mean the actual server. I've coded a client before. As for POP3 you want to say something like this to it:
USER whatever
PASS whatever
STAT
//If their are any messages..
RETR message number //To read the message
DELE message number //To delete the message from the server
If anyone is interested I could dig up my old source code for an email client I wrote. It is quite big though. It was written in Pascal for the Macintosh. If their is a demand i'll upload it somewhere.
Regards,
David Stubbs
Edited by - n0p3x on September 14, 2000 6:33:14 AM
USER whatever
PASS whatever
STAT
//If their are any messages..
RETR message number //To read the message
DELE message number //To delete the message from the server
If anyone is interested I could dig up my old source code for an email client I wrote. It is quite big though. It was written in Pascal for the Macintosh. If their is a demand i'll upload it somewhere.
Regards,
David Stubbs
Edited by - n0p3x on September 14, 2000 6:33:14 AM
Writing an MTA (mail transfer agent) isn''t really a wise thing to do when you don''t know what you need to do (no offense). There are hundreds of things which need to be done, from authentication to anti-SPAM filters to finding what servers to pass the mail on to.
However, if you really want to try, what you need to do is look at each message you''re sending, and find out where the mail servers you need to send it are. (I have no idea how to find the mail servers, sorry)
Your server will also need to recieve mail from other MTAs. How the client gets the mail from you is up to you (be it POP3, IMAP, or a simple UNIX mail box).
http://www.thisisnurgle.org.uk
"Nazrix is cool" Nazrix first, then Darkmage, then Nazrix again
However, if you really want to try, what you need to do is look at each message you''re sending, and find out where the mail servers you need to send it are. (I have no idea how to find the mail servers, sorry)
Your server will also need to recieve mail from other MTAs. How the client gets the mail from you is up to you (be it POP3, IMAP, or a simple UNIX mail box).
http://www.thisisnurgle.org.uk
"Nazrix is cool" Nazrix first, then Darkmage, then Nazrix again
My server wont need to be able to recieve mail from other servers. That would be the role of a POP3 server. I just want to know what is involved in writing an SMTP server. I know the well known servers like sendmail have lots of andanced features but they could all be added in time.
I don''t think that it''s too great a leap from programming many different clients (IRC SMTP & POP3) to looking into what needs doing on the server side of SMTP.
I know I could easily make a server which ''apeared'' to do its job, but once i''ve got the email just pass it of to another server, but this seems like im cheating.
Surely you don''t just connect to the destination server i.e. mail to n0p@owned.lab6.com, connect to owned.lab6.com SMTP server and resend the mail. (the servers firewalled BTW, so dont bother looking at it)
Wasn''t sendmail (an SMTP server) the cause of many security problems accross the internet because it needed special privlidges to write to a uses inbox, which people were abusing and eventually exploiting systems through buffer overflow bugs and the like.
Regards,
David Stubbs
I don''t think that it''s too great a leap from programming many different clients (IRC SMTP & POP3) to looking into what needs doing on the server side of SMTP.
I know I could easily make a server which ''apeared'' to do its job, but once i''ve got the email just pass it of to another server, but this seems like im cheating.
Surely you don''t just connect to the destination server i.e. mail to n0p@owned.lab6.com, connect to owned.lab6.com SMTP server and resend the mail. (the servers firewalled BTW, so dont bother looking at it)
Wasn''t sendmail (an SMTP server) the cause of many security problems accross the internet because it needed special privlidges to write to a uses inbox, which people were abusing and eventually exploiting systems through buffer overflow bugs and the like.
Regards,
David Stubbs
Generally, for each message you send it to the specific mail server. If you look at the mail headers of a message you've recieved, you'll notice that there are usually only 2 Received-by headers (1 if it doesn't have to go to another mail server).
One trick is to send all the mail to another SMTP, which will then send it on to the other servers. If you want to do it that way (which is much easier, but you may get complaints if you're shifting a lot of mail), you program it just like you would a client.
On the subject of recieving mail, the POP3 server only allows users to retrieve mail. If you are setting up a "go between", then you can just grab the mail via POP3 no probs. But if you're setting up a fully fledged MTA, you need to allow other SMTP servers to send mail to yours.
On the subject of the sendmail bug, it wasn't a bug in sendmail, but a bug in the Linux kernel that allowed suid applications that gave up the privileges to "keep" them, and someone found a way to exploit it.
http://www.thisisnurgle.org.uk
"Nazrix is cool" Nazrix first, then Darkmage, then Nazrix again
Edited by - Godfree^ on September 14, 2000 8:25:38 AM
One trick is to send all the mail to another SMTP, which will then send it on to the other servers. If you want to do it that way (which is much easier, but you may get complaints if you're shifting a lot of mail), you program it just like you would a client.
On the subject of recieving mail, the POP3 server only allows users to retrieve mail. If you are setting up a "go between", then you can just grab the mail via POP3 no probs. But if you're setting up a fully fledged MTA, you need to allow other SMTP servers to send mail to yours.
On the subject of the sendmail bug, it wasn't a bug in sendmail, but a bug in the Linux kernel that allowed suid applications that gave up the privileges to "keep" them, and someone found a way to exploit it.
http://www.thisisnurgle.org.uk
"Nazrix is cool" Nazrix first, then Darkmage, then Nazrix again
Edited by - Godfree^ on September 14, 2000 8:25:38 AM
quote:
Original post by n0p3x
Sorry nes, you got the wrong idea. I mean the actual server. I''ve coded a client before. As for POP3 you want to say something like this to it:
No I don''t. I know that''s for sending. I kinda said it. I have my pop3 source somewhere...
---------------------------
"communists eat little kids." -The Alchemist
Topic Locked
This topic has been locked by a moderator. New replies are not allowed.
Sign in to reply to this topic.
Advertisement