Sorry your browser is not supported!

You are using an outdated browser that does not support modern web technologies, in order to use this site please update to a new browser.

Browsers supported include Chrome, FireFox, Safari, Opera, Internet Explorer 10+ or Microsoft Edge.

DarkBASIC Professional Discussion / POP3/SMTP anybody?

Author
Message
mhack2
22
Years of Service
User Offline
Joined: 10th Oct 2003
Location: USA, Earth, Sol[0,0]
Posted: 11th Nov 2003 23:46
Hi guys,

Is there a dll in existence or any way to retrive POP3 messages and send out emails (SMTP) in DBPro?

Thanks,
mhack
IanM
Retired Moderator
23
Years of Service
User Offline
Joined: 11th Sep 2002
Location: In my moon base
Posted: 11th Nov 2003 23:54
TheCodingArea has an email creation DLL on his site, but I don't know exactly which protocol he uses.

There are none that will give you access to SMTP or POP3 servers for downloading that I'm aware of.
OSX Using Happy Dude
22
Years of Service
User Offline
Joined: 21st Aug 2003
Location: At home
Posted: 12th Nov 2003 01:41
You can only send e-mails, via SMTP (the standard system), using my plug-in.


Mirrors are more fun than television. Well, that was fun, in a not-so-fun sort of way...
MicroMan
22
Years of Service
User Offline
Joined: 19th Aug 2003
Location: Stockholm, Sweden
Posted: 12th Nov 2003 03:45 Edited at: 12th Nov 2003 03:46
Since I believe the DBP has internet capability (No, I haven't looked in detail at that side so I may be talking out of my mouth) it shouldn't be a problem implementing POP3/SMTP.

POP3 and SMTP aren't special superprotocols. They're just plain text commands sent in a particular order and in a particular fashion with a TCP-packet on particular sockets. Sorry, I don't think that you can use UDP. So, if you can send out plain text strings with DBP you should be able to implement POP3 and SMTP.

Anyone looking to implement it might consider looking through the RFC protocol definitions at http://www.faqs.org.

I might do so myself, if I wasn't so busy with my own apps at the moment.

-----
They SAID that given enough time a million monkeys with typewriters could recreate the collected works of William Shakespeare... Internet sure proved them wrong.
-----
IanM
Retired Moderator
23
Years of Service
User Offline
Joined: 11th Sep 2002
Location: In my moon base
Posted: 12th Nov 2003 08:58
DBP uses DirectPlay, not sockets, so without a DLL or a plug-in of some sort, you can't implement your own protocols.

There is an old-style DLL for TCP floating around somewhere ...
mhack2
22
Years of Service
User Offline
Joined: 10th Oct 2003
Location: USA, Earth, Sol[0,0]
Posted: 12th Nov 2003 17:27
IanM: This is what I thinking..

TCA: Thanks, I'll check it out.. Could you add POP3 message retrieving/deleting for me? I really need access to POP3/SMTP or just the ability to send recive strings - then I could implement it myself..

Thanks to all,
mhack
OSX Using Happy Dude
22
Years of Service
User Offline
Joined: 21st Aug 2003
Location: At home
Posted: 12th Nov 2003 17:50
Unfortunately if you want to receive e-mails that the program would have to be modified to use COM objects, instead of directly accessing the MAPI.DLL.

Unfortunately, its not something I can do...


Mirrors are more fun than television. Well, that was fun, in a not-so-fun sort of way...
Ariel
23
Years of Service
User Offline
Joined: 15th Sep 2002
Location: Fort Mitchell, KY
Posted: 12th Nov 2003 20:01
I wrote a TCP and UDP communications library some time ago, when DB Pro first came out. One of the examples I included (DB Pro source) is how to send an email. If you read the RFC's for the various Internet protocols, it should be very easy to do.

You can download my free library at:
http://www.lordsofvalour.com/tcpudp.zip

Enjoy... but please don't ask me for any support, since I no longer use DB Pro.
OSX Using Happy Dude
22
Years of Service
User Offline
Joined: 21st Aug 2003
Location: At home
Posted: 12th Nov 2003 23:57
Wont receive e-mails though...


Mirrors are more fun than television. Well, that was fun, in a not-so-fun sort of way...
brittd99
23
Years of Service
User Offline
Joined: 16th Sep 2002
Location:
Posted: 13th Nov 2003 00:22
He is not asking for it to recieve emails, he is asking for it to do "retrieve" POP3 message (from email server) which he can use the TCP dll that is out there and the RFC papers on POP3 retrieval. It is not all that hard since everything is done with ascii and attachments are sent via base64 or other simple code.
I once made an smtp, pop3 & nntp program out of the Old Procomm Plus for windows ASPECT language. Took about a month to make all the basics.
Ariel
23
Years of Service
User Offline
Joined: 15th Sep 2002
Location: Fort Mitchell, KY
Posted: 13th Nov 2003 00:33
Indeed. Using my library, it would be very easy to write a full fledged email client in DB Pro.

Servers are another story. I did not put TCP Server capability in there, because I figured for games people are going to use UDP, not TCP. It would not be that hard to add TCP server capability... but really, who wants to run a mail server or web server written in DB Pro? I guess if someone can justify the time it would take me to add that to the DLL I can do it.
mhack2
22
Years of Service
User Offline
Joined: 10th Oct 2003
Location: USA, Earth, Sol[0,0]
Posted: 13th Nov 2003 06:09
Ok, first of all my personal BIG thanks goes to Ariel for creating this DLL!

THANKS!

I played with it and I like it, it's small has basic ability for TCP and any interface can be implemented..

BUT, there is something that is wrong with it or it's just my SMTP server that is TOO picky..

1. By looking at actual pockets and by refusal of my server to respond on anything TCPPrinted to it - looks like I have to add CRLF to each string on my own? Is this correct?
After adding CRLF on my own server started talking..

2. Looking at the same pockets it looks like it sends more bytes out as there in a string:

0000: 48 45 4c 4f 20 74 6f 6c 31 37 35 2e 38 2e 70 70 | HELO tdg 175.3.pp
0010: 70 2e 74 6f 61 73 74 2e 6e 65 74 0d 0a 00 00 00 | p.cream. net.....
0020: 00 00 00 00 00 00 00 00 31 00 00 00 31 00 00 00 | ........ 1...1...
0030: 48 0d 0a | H..

Instead of this:

0000: 48 45 4c 4f 20 74 6f 6c 31 37 35 2e 38 2e 70 70 | HELO tdg 175.3.pp
0010: 70 2e 74 6f 61 73 74 2e 6e 65 74 0d 0a | p.cream. net..

Another example from my log software:

TCP packet from 111.222.3.111:1662 to 222.333.444.10:25
0000: 44 41 54 41 0d 0a 00 01 11 00 00 00 31 00 00 00 |
DATA.... ....1...
0010: 52 0d 0a | R..

So my SMTP server sees all comands even with junk added but comand DATA it fails to stop it.. Somehow it doesn't react on CRLF.CRLF..

Ariel could you confirm that my findings are false/true?

I know you said no support questions But I had to

mhack

Hi-Res textures for your game.. [url]akdusa.com[/url]
Ariel
23
Years of Service
User Offline
Joined: 15th Sep 2002
Location: Fort Mitchell, KY
Posted: 13th Nov 2003 07:04
Hmm. It worked fine for me when I first did it... I'll have to re-install DarkBasic Pro and play with it again. Maybe something has changed in DB's string handling since the very first version?

One thing you might want to try is just send a CR (ASCII character 13).. I think that is correct, but don't quote me on it.
Ariel
23
Years of Service
User Offline
Joined: 15th Sep 2002
Location: Fort Mitchell, KY
Posted: 13th Nov 2003 07:09
I took a look at the source code... you should not need to send a CR at the end of the line, as this should be done automatically....
mhack2
22
Years of Service
User Offline
Joined: 10th Oct 2003
Location: USA, Earth, Sol[0,0]
Posted: 13th Nov 2003 16:28
This is strange..
I was looking at actual packets my mailer software sends and DBPro with your dll sends..

Mailer sends only needed information like:

DATA 13 10

That's it, server responds to it perfectly.. but,
DBPro with your dll sends always some garbage at the end like this:
DATA 0 0 0 1 0 0 0 1 0 0 0 0 5 13 10

It's always like string size is incorect and CR LF is added at the very end of it.. If I would add CR LF in the DBPRo before the call it will look like this:

DATA 13 10 0 0 0 1 0 0 0 1 0 0 0 0 5 13 10

Even like that commands like DATA work fine I get 250 ok reply,
but then I send my email body with CRLF.CRLF (or .CRLF) at the end and of course it sends packet which is longer and server never gets CRLF.CRLF part so it assumes all commands I send are part of email body..

BTW I send email body as a total copy of one send by my mailer program.. so they look identical with only difference being the end of the packet:

Original end: "This is test"CRLF.CRLF
DBPRo+dll: "This is test"CRLF.CRLF 0 0 0 2 0 0 0 4 1 5 2 13 10
OD$ OA$ $2E OD$ $OA $0 $0 $0 $2 $0 $0 $0 $4 $1 $5 $2 $0D $0A

This is for call TCPPrint "This is test" + CHR$(13) + CHR$(10)

Hi-Res textures for your game.. [url]akdusa.com[/url]
Ariel
23
Years of Service
User Offline
Joined: 15th Sep 2002
Location: Fort Mitchell, KY
Posted: 13th Nov 2003 19:07
Have you tried using the SMTP example I provided with the .ZIP?

I will write an option into the TCPPrint function to send/not send
a CRLF at the end of the line... maybe that will work better.
Ariel
23
Years of Service
User Offline
Joined: 15th Sep 2002
Location: Fort Mitchell, KY
Posted: 13th Nov 2003 19:09
Oh - how large is the string you're passing to the DLL that contains
the body of the email? That could be the problem.

Have you tried sending it one line at a time?
mhack2
22
Years of Service
User Offline
Joined: 10th Oct 2003
Location: USA, Earth, Sol[0,0]
Posted: 13th Nov 2003 20:31
Basically what I did first I compiled your example,
It only returned 220 Gretting from my SMTP server,
then (HELO command) nothing from server..

I downloaded a packet spy program and logged 2 log files..
log 1 is I'm sending a email "This is test" using my email program
log 2 is your example "This is test" as email body

Then I compared them..

Looks like if in log 1 it was sending
HELO aaa.bbb.com 13 10
in log 2 it would look like
HELO aaa.bbb.com 0 0 0 0 4 0 0 0 7 0 0 4 0 0 13 10

And this with every command..

Then I made changes in your DBPro example:
CRLF$ = CHR$(13) + CHR$(10)

And I changed evey TCPPrint to:
TCPPrint(..whatever here.., email$ + CRLF$)

so it would send CRLF for sure.

After that I got responses (using your SMTP example, now modified)
I got 250 OK for different comands..
log 2 now looks like this:
HELO aaa.bbb.com 13 10 0 0 0 0 4 0 0 0 7 0 0 4 0 0 13 10

But now the problem is it's not responding to body message (to "." 13 10)

The last thing it responds is
"DATA", 13 10

It responds with:
(35x something) Ready for your data

And then I send message body and no responses from server..
If I will wait long enough it gives me Time Out message..

1. Could you check that string of correct lenght is send to sever? Maybe length is not right or something.

2. Could you look at packets it sends out? You will see what I'm talking about.

Thanks a lot! I think that the problem is to get packet size correct and it will solve everything..

mhack

Hi-Res textures for your game.. [url]akdusa.com[/url]
Ariel
23
Years of Service
User Offline
Joined: 15th Sep 2002
Location: Fort Mitchell, KY
Posted: 13th Nov 2003 20:52
I'll just change it to let you change the buffer size manually. I don't think it has that feature now, but it's easy enough to implement.

From what you're describing though, I think something is goofy with the way DB stores strings.
mhack2
22
Years of Service
User Offline
Joined: 10th Oct 2003
Location: USA, Earth, Sol[0,0]
Posted: 13th Nov 2003 20:52
I assume you use this WSOCK32.dll call

int send (

SOCKET s,
const char FAR * buf,
int len,
int flags
);


Could you check that [len] is correct for string we trying to send..
It looks like len is larger then actual string size..

Thanks
mhack

Hi-Res textures for your game.. [url]akdusa.com[/url]
mhack2
22
Years of Service
User Offline
Joined: 10th Oct 2003
Location: USA, Earth, Sol[0,0]
Posted: 13th Nov 2003 20:57
Oops you beat me on that post
Yeah, would be cool if I could change buffer size manually..

Yes, I suspect the way DB stores/passes strings to DLL is messed up so when this strings travels further it some how gets incorect length or something..

And those 0s are garbage I know for sure some time I see parts of words (memory garbage) like:

[email protected]......

(I used email [email protected] in emailto)


p.s. In your example code there is one call to DLL #2 and function "HIDDEN" ..?

Hi-Res textures for your game.. [url]akdusa.com[/url]
Ariel
23
Years of Service
User Offline
Joined: 15th Sep 2002
Location: Fort Mitchell, KY
Posted: 13th Nov 2003 21:29
There is? I am not sure, I haven't looked at that stuff in months. I do have a lot of the groundwork for TCP server capability in there, so maybe thats what it's calling.. or maybe it was something I had in there for testing purposes and forgot to remove..who knows.

Maybe I'll just post the source for this thing, it's in PowerBASIC, just like my String Functions Library.
mhack2
22
Years of Service
User Offline
Joined: 10th Oct 2003
Location: USA, Earth, Sol[0,0]
Posted: 13th Nov 2003 21:58
What is a POWERBASIC?
Yeah, source will be nice..

I'm thinking maybe I shoud just use WSOCK32.DLL with DBPro dll functions.. looks like there is everything we need..

Hi-Res textures for your game.. [url]akdusa.com[/url]
Ariel
23
Years of Service
User Offline
Joined: 15th Sep 2002
Location: Fort Mitchell, KY
Posted: 13th Nov 2003 22:01
PowerBASIC is the best basic compiler around. www.powerbasic.com. They have Windows, DOS, Windows Console versions with a Linux version planned. They've been around forever. Remember Borland Turbo Basic? That was PowerBASIC/DOS
mhack2
22
Years of Service
User Offline
Joined: 10th Oct 2003
Location: USA, Earth, Sol[0,0]
Posted: 13th Nov 2003 23:36
So could you change it so I can set block size?

Hi-Res textures for your game.. [url]akdusa.com[/url]
Ariel
23
Years of Service
User Offline
Joined: 15th Sep 2002
Location: Fort Mitchell, KY
Posted: 14th Nov 2003 01:43
Try this version:

http://www.lordsofvalour.com/network.dll

I added a new command called TCPInput:


Command : TCPInput
Format : packet$ = call dll(1,"TCPInput",FileHandle,numbytes)
Description : Receives a specified number of bytes from the TCP server.

See if the problem goes away if you use this instead of TCPLineInput. I think there may be a problem that is jumbling the data after you use that command.
mhack2
22
Years of Service
User Offline
Joined: 10th Oct 2003
Location: USA, Earth, Sol[0,0]
Posted: 14th Nov 2003 02:52
EDIT: I can't get it off your servel I get 404 Error..

I will try that instead of LineInput but the problem is for sure with Print command, could you add numbytes to print command?

Try using packets spy program to see what it sends out, every packet has some stuff added to it (or incorect size is set)..

Hi-Res textures for your game.. [url]akdusa.com[/url]
Ariel
23
Years of Service
User Offline
Joined: 15th Sep 2002
Location: Fort Mitchell, KY
Posted: 14th Nov 2003 05:22
The code is only sending out what DarkBasic is sending to it, it adds nothing. I'll have to re-install DB to investigate further.
mhack2
22
Years of Service
User Offline
Joined: 10th Oct 2003
Location: USA, Earth, Sol[0,0]
Posted: 14th Nov 2003 16:03
I understand It looks like somewhere in a process string length gets screwed..

Anyway, thanks for help, if you need me to test something drop me an email..

Arseny

Hi-Res textures for your game.. [url]akdusa.com[/url]
Ariel
23
Years of Service
User Offline
Joined: 15th Sep 2002
Location: Fort Mitchell, KY
Posted: 14th Nov 2003 16:34
I'm going to re-write the whole DLL into just one function... I think that may be part of the problem. :/
mhack2
22
Years of Service
User Offline
Joined: 10th Oct 2003
Location: USA, Earth, Sol[0,0]
Posted: 14th Nov 2003 21:30
One function?

Maybe 3 functions like Init and read/write..

BTW, did you find any problems with it?

Thanks,
Arseny

Hi-Res textures for your game.. [url]akdusa.com[/url]
Ariel
23
Years of Service
User Offline
Joined: 15th Sep 2002
Location: Fort Mitchell, KY
Posted: 17th Nov 2003 16:26
Actually I've changed it considerably. It now opens up a hidden window for callbacks.... and I went ahead and put TCP server capability in it too... Just need to test it with DB Pro now, if I can find the CD to re-install it.

Login to post a reply

Server time is: 2026-07-26 20:16:49
Your offset time is: 2026-07-26 20:16:49