www.digitalmars.com         C & C++   DMDScript  

digitalmars.D - Pop3 connection with D

reply Roger <ruio hotmail.com> writes:
Hello i'm student of College of Engineering Informatics in Fribourg Switzerland.

For a semester project i want to create a E-mail client with D.

Anyone can help me to know how to create a pop3 and smtp connection with D?
I have searched a lot but i found only a dead reference:
http://www.digitalmars.com/d/archives/digitalmars/D/22349.html

Tanks a lot, bye, Roger
Mar 08 2007
next sibling parent reply BCS <BCS pathlink.com> writes:
Roger wrote:
 Hello i'm student of College of Engineering Informatics in Fribourg
Switzerland.
 
 For a semester project i want to create a E-mail client with D.
 
 Anyone can help me to know how to create a pop3 and smtp connection with D?
 I have searched a lot but i found only a dead reference:
 http://www.digitalmars.com/d/archives/digitalmars/D/22349.html
 
 Tanks a lot, bye, Roger
As with a lot of D you might (but not nessisaraly) have to roll your own. SMTP isn't that bad (I've used it by hand in telnet). I expect pop would be about the same. IIRC there /is/ a lib out there for SMTP. If you feel "nerdy" enough you can just read the RFC's <G> pop3 http://tools.ietf.org/html/rfc1939 SMTP http://tools.ietf.org/html/rfc2821
Mar 08 2007
parent reply "Andrei Alexandrescu (See Website For Email)" <SeeWebsiteForEmail erdani.org> writes:
BCS wrote:
 Roger wrote:
 Hello i'm student of College of Engineering Informatics in Fribourg 
 Switzerland.

 For a semester project i want to create a E-mail client with D.

 Anyone can help me to know how to create a pop3 and smtp connection 
 with D?
 I have searched a lot but i found only a dead reference:
 http://www.digitalmars.com/d/archives/digitalmars/D/22349.html

 Tanks a lot, bye, Roger
As with a lot of D you might (but not nessisaraly) have to roll your own. SMTP isn't that bad (I've used it by hand in telnet). I expect pop would be about the same. IIRC there /is/ a lib out there for SMTP. If you feel "nerdy" enough you can just read the RFC's <G> pop3 http://tools.ietf.org/html/rfc1939 SMTP http://tools.ietf.org/html/rfc2821
Possibly implementing protocols could be an area in which DSLs might help, e.g. in the guise of automata and of course regex. I once designed a little DSL for implementing FTP and it was of great help. Andrei
Mar 08 2007
parent reply kris <foo bar.com> writes:
Andrei Alexandrescu (See Website For Email) wrote:
 Possibly implementing protocols could be an area in which DSLs might 
 help, e.g. in the guise of automata and of course regex. I once designed 
 a little DSL for implementing FTP and it was of great help.
Compile-time DSLs?
Mar 08 2007
parent reply "Andrei Alexandrescu (See Website For Email)" <SeeWebsiteForEmail erdani.org> writes:
kris wrote:
 Andrei Alexandrescu (See Website For Email) wrote:
 Possibly implementing protocols could be an area in which DSLs might 
 help, e.g. in the guise of automata and of course regex. I once 
 designed a little DSL for implementing FTP and it was of great help.
Compile-time DSLs?
Obviously. Andrei
Mar 08 2007
parent reply kris <foo bar.com> writes:
Andrei Alexandrescu (See Website For Email) wrote:
 kris wrote:
 
 Andrei Alexandrescu (See Website For Email) wrote:

 Possibly implementing protocols could be an area in which DSLs might 
 help, e.g. in the guise of automata and of course regex. I once 
 designed a little DSL for implementing FTP and it was of great help.
Compile-time DSLs?
Obviously.
That sounds reasonably sophisticated. Just out of interest, how does one easily debug something like that?
Mar 08 2007
parent reply "Andrei Alexandrescu (See Website For Email)" <SeeWebsiteForEmail erdani.org> writes:
kris wrote:
 Andrei Alexandrescu (See Website For Email) wrote:
 kris wrote:

 Andrei Alexandrescu (See Website For Email) wrote:

 Possibly implementing protocols could be an area in which DSLs might 
 help, e.g. in the guise of automata and of course regex. I once 
 designed a little DSL for implementing FTP and it was of great help.
Compile-time DSLs?
Obviously.
That sounds reasonably sophisticated. Just out of interest, how does one easily debug something like that?
Very easy. The FTP protocol is described as a collection of states with prescribed transitions in between them. A DFA (in C++) implemented them in a compact manner; whenever the DFA would bail out (by throwing), it would tell what state it was in, what was the expected input, and what the actual input was. I remember that library was a rewrite of a library written in a "old school" style from first principles (e.g. int and if and switch), meaning that following what the code does and where you are was horrendous. We were very pleased with the rewrite. Andrei
Mar 08 2007
parent reply kris <foo bar.com> writes:
Andrei Alexandrescu (See Website For Email) wrote:
 kris wrote:
 
 Andrei Alexandrescu (See Website For Email) wrote:

 kris wrote:

 Andrei Alexandrescu (See Website For Email) wrote:

 Possibly implementing protocols could be an area in which DSLs 
 might help, e.g. in the guise of automata and of course regex. I 
 once designed a little DSL for implementing FTP and it was of great 
 help.
Compile-time DSLs?
Obviously.
That sounds reasonably sophisticated. Just out of interest, how does one easily debug something like that?
Very easy. The FTP protocol is described as a collection of states with prescribed transitions in between them. A DFA (in C++) implemented them in a compact manner; whenever the DFA would bail out (by throwing), it would tell what state it was in, what was the expected input, and what the actual input was. I remember that library was a rewrite of a library written in a "old school" style from first principles (e.g. int and if and switch), meaning that following what the code does and where you are was horrendous. We were very pleased with the rewrite. Andrei
sounds good. Yet, you appear to be describing a "black-box" of sorts, with diagnostic exceptions? My guess is that interactive "step through" debugging, with something like MSVC6 for example, would not be particularly feasible?
Mar 08 2007
parent reply "Andrei Alexandrescu (See Website For Email)" <SeeWebsiteForEmail erdani.org> writes:
kris wrote:
 Andrei Alexandrescu (See Website For Email) wrote:
 kris wrote:

 Andrei Alexandrescu (See Website For Email) wrote:

 kris wrote:

 Andrei Alexandrescu (See Website For Email) wrote:

 Possibly implementing protocols could be an area in which DSLs 
 might help, e.g. in the guise of automata and of course regex. I 
 once designed a little DSL for implementing FTP and it was of 
 great help.
Compile-time DSLs?
Obviously.
That sounds reasonably sophisticated. Just out of interest, how does one easily debug something like that?
Very easy. The FTP protocol is described as a collection of states with prescribed transitions in between them. A DFA (in C++) implemented them in a compact manner; whenever the DFA would bail out (by throwing), it would tell what state it was in, what was the expected input, and what the actual input was. I remember that library was a rewrite of a library written in a "old school" style from first principles (e.g. int and if and switch), meaning that following what the code does and where you are was horrendous. We were very pleased with the rewrite. Andrei
sounds good. Yet, you appear to be describing a "black-box" of sorts, with diagnostic exceptions? My guess is that interactive "step through" debugging, with something like MSVC6 for example, would not be particularly feasible?
Stepping through was of course possible and useful. The main difference was that stepping through manually-written code was replaced by stepping through the more compact templated code. The instantiation types are different and therefore different actual binary code maps to the same source line. Andrei
Mar 08 2007
parent reply Sean Kelly <sean f4.ca> writes:
Andrei Alexandrescu (See Website For Email) wrote:
 
 Stepping through was of course possible and useful. The main difference 
 was that stepping through manually-written code was replaced by stepping 
 through the more compact templated code. The instantiation types are 
 different and therefore different actual binary code maps to the same 
 source line.
It sounds like you're describing debugging C++ template code. Would the same thing be possible with code generated from strings in D via mixin? I suppose the compiler could output source files to pair with the object files, but beyond that I don't see how this could be done. Sean
Mar 08 2007
next sibling parent reply "Andrei Alexandrescu (See Website For Email)" <SeeWebsiteForEmail erdani.org> writes:
Sean Kelly wrote:
 Andrei Alexandrescu (See Website For Email) wrote:
 Stepping through was of course possible and useful. The main 
 difference was that stepping through manually-written code was 
 replaced by stepping through the more compact templated code. The 
 instantiation types are different and therefore different actual 
 binary code maps to the same source line.
It sounds like you're describing debugging C++ template code. Would the same thing be possible with code generated from strings in D via mixin? I suppose the compiler could output source files to pair with the object files, but beyond that I don't see how this could be done.
Shriram Krishnamurthi has done work on macros that allow traceability back to the source code of the macro, but probably that won't be doable for string-generated code. We need to devise a solution to that; for example, for each file blah.d that contains mixins, the compiler could automatically generate blah.d.expanded and make debugging info point into that file. Andrei
Mar 08 2007
parent BCS <BCS pathlink.com> writes:
Andrei Alexandrescu (See Website For Email) wrote:
 Sean Kelly wrote:
 
 Andrei Alexandrescu (See Website For Email) wrote:

 Stepping through was of course possible and useful. The main 
 difference was that stepping through manually-written code was 
 replaced by stepping through the more compact templated code. The 
 instantiation types are different and therefore different actual 
 binary code maps to the same source line.
It sounds like you're describing debugging C++ template code. Would the same thing be possible with code generated from strings in D via mixin? I suppose the compiler could output source files to pair with the object files, but beyond that I don't see how this could be done.
Shriram Krishnamurthi has done work on macros that allow traceability back to the source code of the macro, but probably that won't be doable for string-generated code. We need to devise a solution to that; for example, for each file blah.d that contains mixins, the compiler could automatically generate blah.d.expanded and make debugging info point into that file. Andrei
Assuming somthing like my dparse is used, another choice is to, inside of the static foreaches put in a debug block that assigns the values of the template variables to local variables then you can look at them in the debugger and figure out what state you are in. I /realy/ need to get a debugger and see what happens when I step throught some of this stuff. <G>
Mar 08 2007
prev sibling parent janderson <askme me.com> writes:
Sean Kelly wrote:
 Andrei Alexandrescu (See Website For Email) wrote:
 Stepping through was of course possible and useful. The main 
 difference was that stepping through manually-written code was 
 replaced by stepping through the more compact templated code. The 
 instantiation types are different and therefore different actual 
 binary code maps to the same source line.
It sounds like you're describing debugging C++ template code. Would the same thing be possible with code generated from strings in D via mixin? I suppose the compiler could output source files to pair with the object files, but beyond that I don't see how this could be done. Sean
Its the same with any DSL compile-time or not. You simply need to crate your own system to do it. Most DSLs I've used (lua, shader lanaguages, script languages, xml) have done that. Its not difficult. It would be nice if the DSL helper library had some helpers for it though. -Joel
Mar 08 2007
prev sibling next sibling parent Lars Ivar Igesund <larsivar igesund.net> writes:
Roger wrote:

 Hello i'm student of College of Engineering Informatics in Fribourg
 Switzerland.
 
 For a semester project i want to create a E-mail client with D.
 
 Anyone can help me to know how to create a pop3 and smtp connection with
 D? I have searched a lot but i found only a dead reference:
 http://www.digitalmars.com/d/archives/digitalmars/D/22349.html
 
 Tanks a lot, bye, Roger
There is a Pop3 client in Tango's patches directory which is likely to be included in a later release. We hope to get smtp too, but it's further away. -- Lars Ivar Igesund blog at http://larsivi.net DSource, #d.tango & #D: larsivi Dancing the Tango
Mar 08 2007
prev sibling next sibling parent Alan Knowles <alan akbkhome.com> writes:
This may get you started..
Main Sending Code
http://www.akbkhome.com/svn/team/dinc/src/dinc/deliver/Smtp.d
MX Lookup code
http://www.akbkhome.com/svn/team/dinc/src/dinc/deliver/MxRecord.d
Usage Example.
http://www.akbkhome.com/svn/team/dinc/src/dinc/deliver/External.d

Regards
Alan

Roger wrote:
 Hello i'm student of College of Engineering Informatics in Fribourg
Switzerland.
 
 For a semester project i want to create a E-mail client with D.
 
 Anyone can help me to know how to create a pop3 and smtp connection with D?
 I have searched a lot but i found only a dead reference:
 http://www.digitalmars.com/d/archives/digitalmars/D/22349.html
 
 Tanks a lot, bye, Roger
Mar 08 2007
prev sibling parent "Unknown W. Brackets" <unknown simplemachines.org> writes:
POP3 really isn't very complicated.  I've written clients for POP3 and 
SMTP (not in D) and it's really just a matter of following the RFCs. 
They're all command based so it's really just a matter of parsing the 
responses.

In fact, it wouldn't be that hard to adapt an existing FTP or SMTP 
implementation to POP3.  FTP is definitely much more complicated.

-[Unknown]


 Hello i'm student of College of Engineering Informatics in Fribourg
Switzerland.
 
 For a semester project i want to create a E-mail client with D.
 
 Anyone can help me to know how to create a pop3 and smtp connection with D?
 I have searched a lot but i found only a dead reference:
 http://www.digitalmars.com/d/archives/digitalmars/D/22349.html
 
 Tanks a lot, bye, Roger
Mar 08 2007