LinuxQuestions.org
Help answer threads with 0 replies.
Home Forums Tutorials Articles Register
Go Back   LinuxQuestions.org > Forums > Non-*NIX Forums > Programming
User Name
Password
Programming This forum is for all programming questions.
The question does not have to be directly related to Linux and any language is fair game.

Notices


Reply
  Search this Thread
Old 12-31-2005, 05:03 AM   #1
Ellops
Member
 
Registered: Nov 2005
Location: ath.gr
Distribution: Slackware 11.0 / 2.6.19.1 /Linux Mint
Posts: 124

Rep: Reputation: 15
Question SMTP - Sockets / Specification file


Hi codrades.

I've undertaken a project in university, that(in a part) has to do with sending e-mail.

The technical part of implementation is not much of concern right now. I just want play a bit
with the smpt prot, getting aquanted with it.

Does anybody knows where can I find a spefication file on smtp protocol?

I dont mean the rfc's, available.

For example:
I wrote a simple prog in C, that works with the same logic as telneting an SMTP server.It connects to a spcific server and does nothing until it gets a 220 reply. Walking through existing API's (quit creepy) I found that the reply should be read as a LONG number...
Guess what... it didn't work! It connects but the reply was something scrappy...

Obviously I missing something... Thats why I need documentation on technical stuff like that (can I name it SMTP specification file? )

My ignorance don't let me be more specific, Im quite lost...

If anybody has gone through the same, please help a bit. Even a hint or a specific "keyword" will do.. (I know, some things cannot be explained, through forums.)

Thanx.

Last edited by Ellops; 12-31-2005 at 05:10 AM.
 
Old 12-31-2005, 06:26 AM   #2
dmail
Member
 
Registered: Oct 2005
Posts: 970

Rep: Reputation: Disabled
I think these are the two you need to look at rfc821 and the updated rfc2821.
http://www.faqs.org/rfcs/rfc821.html
http://www.faqs.org/rfcs/rfc2821.html

<edit> I just noticed you said
Quote:
I dont mean the rfc's, available.
So what is it your are looking for then?

Last edited by dmail; 12-31-2005 at 09:01 AM.
 
Old 12-31-2005, 10:11 PM   #3
foo_bar_foo
Senior Member
 
Registered: Jun 2004
Posts: 2,553

Rep: Reputation: 53
yea i can't figure out what you are saying either
i don't know what you mean reply is a long number ?
it replys a string and you have to use atoi() to get the number from the string
a snipit of code from a smtp class i wrote might help
FILE *rfp; // is the recieve socket
Code:
int  mySMTP::get_response()
{
    char buf[BUFSIZ];
    char nCode[4]={0};
    while (fgets(buf, sizeof(buf), rfp)) {
        buf[strlen(buf)-1] = 0;
        printf("%s --> %s\n", host, buf);
        if (!isdigit(buf[0]) || buf[0] > '3') {
	  //exit(1);
          return 1;
        }
        if (buf[4] != '-')
            break;
    }
    strncpy(nCode, buf, 3);
    nCode[3] = '\0';
    return (atoi(nCode));
}
 
Old 12-31-2005, 11:43 PM   #4
paulsm4
LQ Guru
 
Registered: Mar 2004
Distribution: SusE 8.2
Posts: 5,863
Blog Entries: 1

Rep: Reputation: Disabled
You can't understand SMTP without understanding the RFC's...

The heart of SMTP (and quite likely the gist of the exercise with "telnet" you mentioned) is the *protocol*. Not the networking, not any hypothetical API.

And it happens to be a *text* protocol (having nothing directly to do with "long's" or with C programs).

I agree with the previous two poster's: there's absolutely no better place to start out than with the RFC's:

Quote:
I think these are the two you need to look at rfc821 and the updated rfc2821.
http://www.faqs.org/rfcs/rfc821.html
http://www.faqs.org/rfcs/rfc2821.html
 
Old 01-02-2006, 06:04 AM   #5
Ellops
Member
 
Registered: Nov 2005
Location: ath.gr
Distribution: Slackware 11.0 / 2.6.19.1 /Linux Mint
Posts: 124

Original Poster
Rep: Reputation: 15
Quote:
Originally Posted by paulsm4
And it happens to be a *text* protocol (having nothing directly to do with "long's" or with C programs).
oh, say that again...!

Thanks alot guys,all of u, I was lookin in wrong places... I'd already read the rfc's, but things were not cleared in my mind.
Yes, now works fine.

Many thanks!
 
Old 05-05-2006, 03:18 AM   #6
vskgopu
LQ Newbie
 
Registered: May 2006
Posts: 17

Rep: Reputation: 0
Which is best for implementing SMTP relay servers in unix.. fork or pthread ?
 
Old 05-05-2006, 03:19 AM   #7
vskgopu
LQ Newbie
 
Registered: May 2006
Posts: 17

Rep: Reputation: 0
Which is best for implementing SMTP relay servers in unix.. fork or pthread ?
 
  


Reply



Posting Rules
You may not post new threads
You may not post replies
You may not post attachments
You may not edit your posts

BB code is On
Smilies are On
[IMG] code is Off
HTML code is Off



Similar Threads
Thread Thread Starter Forum Replies Last Post
SMTP - Sockets Ellops Programming 0 12-31-2005 05:02 AM
how can i send a file using linux sockets?? crapodino Programming 2 10-09-2005 11:17 PM
SuSe specification undeadpoll SUSE / openSUSE 1 09-18-2005 07:37 AM
List Hardware Specification arch4n93l Linux - Hardware 1 01-04-2005 07:06 AM
[help]Using Ssh, How To See Server Specification one1coolone1 Linux - Software 2 04-23-2004 09:19 AM

LinuxQuestions.org > Forums > Non-*NIX Forums > Programming

All times are GMT -5. The time now is 03:08 PM.

Main Menu
Advertisement
My LQ
Write for LQ
LinuxQuestions.org is looking for people interested in writing Editorials, Articles, Reviews, and more. If you'd like to contribute content, let us know.
Main Menu
Syndicate
RSS1  Latest Threads
RSS1  LQ News
Twitter: @linuxquestions
Open Source Consulting | Domain Registration