Page 10 of 25
Posted: Wed Jan 31, 2007 8:45 am
by gnozal
I could reproduce the PureSMTP_SetXMailer() crash on Win98SE.
It seems to be some strange PB4/Tailbite memory management issue, because :
- the same code works with PB4 on NT based systems
- the same code works with PB3.94 on NT based systems AND Win95 based systems
I think I found the problem : the string variable initialization in PureSMTP_Init() when the library is loaded.
If I avoid this, there is no crash anymore.
Changes :
Code: Select all
ProcedureDLL PureSMTP_Init()
...
; PureSMTP_ContentType = "text/plain; charset=" + #g + "iso-8859-1" + #g
; PureSMTP_XMailer = "PureSMTP"
; PureSMTP_Boundary = "PureSMTP_"
...
EndProcedure
;
Procedure.l PureSMTP_SendMailEx(MailTo.s, MailFrom.s, Subject.s, MsgBody.s, Attachments.s, UserName.s, Password.s, HeaderAddon.s)
...
;
If PureSMTP_XMailer = ""
PureSMTP_XMailer = "PureSMTP"
EndIf
If PureSMTP_ContentType = ""
PureSMTP_ContentType = "text/plain; charset=" + #g + "iso-8859-1" + #g
EndIf
If PureSMTP_Boundary = ""
PureSMTP_Boundary = "PureSMTP_"
EndIf
;
...
EndProcedure
Could you please test
http://freenet-homepage.de/gnozal/PureSMTP_BETA.zip (ANSI PureSMTP beta lib) under Win9x/Me ?
The users with NT based systems too please. If it works, I will update the PB4 library.
Posted: Wed Jan 31, 2007 11:54 am
by akj
DoubleDutch:
I have sent you the files, as requested, but in the light of Gnozal's last post it is likely that any analysis of the files will now be redundant. Many thanks for offering your help, it is really appreciated.
Gnozal:
The Beta library seems to solve the crashout problems under Windows ME. Deep joy! Thank you.
In summary, these now work correctly:
PureSMTP_SetContentType()
PureSMTP_SetXMailer()
PureSMTP_SetTimeOut() - though I think this has always worked
I have not yet tested these:
PureSMTP_SetBoundary()
PureSMTP_AddHeader()
PureSMTP_ClearHeader()
I have two requests:
1. Minor request: Would it be possible for either the X-Mailer to default to <null> rather than "PureSMTP" or for there to be some [other] way of supressing the X-Mailer line?
2. Major request: I need a way of discovering whether a previously created SMTP connection still exists or whether it been unexpectedly lost so that I need to create another. This is to cover the situation where I am automatically sending an email at regular intervals and it seems a waste of resources to create and close the SMTP connection for every email. So I would like to stay connected for the duration of sending all the emails (perhaps over a period of an hour or more), but have a capability of detecting that the connection has unexpectedly become lost before sending my next email.
[Or would opening a new connection do nothing if the previous connection was still open? This may be an indirect way of resolving my request.]
Posted: Wed Jan 31, 2007 2:37 pm
by gnozal
akj wrote:The Beta library seems to solve the crashout problems under Windows ME. Deep joy! Thank you.
Good news.
akj wrote:1. Minor request: Would it be possible for either the X-Mailer to default to <null> rather than "PureSMTP" or for there to be some [other] way of supressing the X-Mailer line?
Actually no. What's the problem ?
akj wrote:2. Major request: I need a way of discovering whether a previously created SMTP connection still exists or whether it been unexpectedly lost so that I need to create another. This is to cover the situation where I am automatically sending an email at regular intervals and it seems a waste of resources to create and close the SMTP connection for every email. So I would like to stay connected for the duration of sending all the emails (perhaps over a period of an hour or more), but have a capability of detecting that the connection has unexpectedly become lost before sending my next email.
[Or would opening a new connection do nothing if the previous connection was still open? This may be an indirect way of resolving my request.]
Why don't you just use the sequence PureSMTP_OpenSMTPConnection() / send mail / PureSMTP_CloseSMTPConnection() each time you send mail ?
Anyway, if you call PureSMTP_OpenSMTPConnection() without having closed the previous connection with PureSMTP_CloseSMTPConnection(), PureSMTP will just keep using current connection.
If the server has disconnected and you try to send some mail, you will get an error, probably #PureSMTP_BadResponse (check PureSMTP_GetLastServerMessage())
Posted: Wed Jan 31, 2007 3:24 pm
by gnozal
Update (PB4 version only)
Changes :
- fixed a strange PB4/Tailbite memory management issue under Win9x/Me
(crashed functions PureSMTP_ContentType() PureSMTP_XMailer() PureSMTP_Boundary())
Posted: Wed Jan 31, 2007 4:19 pm
by akj
Gnozal wrote:
If you call PureSMTP_OpenSMTPConnection() without having closed the previous connection with PureSMTP_CloseSMTPConnection(), PureSMTP will just keep using current connection
This solves my main request. Thank you.
Is there any chance of you adding that important fact to your documentation for PureSMTP_OpenSMTPConnection() and, if appropriate, for PureSMTP_OpenPOP3ThenSMTPConnection().
Posted: Wed Jan 31, 2007 4:39 pm
by gnozal
akj wrote:Is there any chance of you adding that important fact to your documentation for PureSMTP_OpenSMTPConnection() and, if appropriate, for PureSMTP_OpenPOP3ThenSMTPConnection().
I will.
Posted: Mon Mar 05, 2007 4:55 am
by citystate
could someone supply a valid link to PureSMTP, all the ones I've followed timeout (including the one from PureArea)
Thanks
Matt
Posted: Mon Mar 05, 2007 5:23 am
by GeoTrail
Try a different browser!
Posted: Mon Mar 05, 2007 5:20 pm
by citystate
I've tried both the evil IE and the not-so-evil Mozilla, neither want to work - my guess is that gnozal's site is down for whatever reason.
does anyone have this lib (and are prepared to host it?)
Posted: Mon Mar 05, 2007 5:36 pm
by GeoTrail
I tried downloading yesterday and 2 secs ago and it worked fine here.
Posted: Mon Mar 05, 2007 5:43 pm
by gnozal
citystate wrote:I've tried both the evil IE and the not-so-evil Mozilla, neither want to work - my guess is that gnozal's site is down for whatever reason.
The site is not down, and I have no problems downloading. Maybe a firewall / antivirus problem ?
Anyway, you can also try PureArea (may not be the latest version though) :
http://www.purearea.net/pb/english/userlibs.php
Posted: Tue Mar 06, 2007 2:17 am
by citystate
thanks - I'm still getting the problem though (well, not with the 3.91 version, but definitely with the 4.x one). Doesn't appear to be a firewall problem.
oh well - thanks for the effort guys, I'm sure the lib would have been perfect

guess I'll have to remake the wheel
ahh - nevermind, I managed to find it here -->
http://www.purearea.net/pb/download/use ... eSMTP_.zip
Posted: Thu Mar 29, 2007 11:39 am
by Kukulkan
Hi gnozal,
I currently use your library on a PB3.94 project. It works fine, but some people ask for using SSL/TLS for sending e-mails (especially those who are using gmail.com). Is it possible to send and receive e-mails using SSL/TLS? Actualy, only sending is important for me.
I don't know which API's you are using, but maybe it is possible to use InternetOpenUrl_() with the #INTERNET_FLAG_SECURE flag to connect to the server?
regards,
Kukulkan
Posted: Thu Mar 29, 2007 11:44 am
by gnozal
Kukulkan wrote:Hi gnozal,
I currently use your library on a PB3.94 project. It works fine, but some people ask for using SSL/TLS for sending e-mails (especially those who are using gmail.com). Is it possible to send and receive e-mails using SSL/TLS? Actualy, only sending is important for me.
I don't know which API's you are using, but maybe it is possible to use InternetOpenUrl_() with the #INTERNET_FLAG_SECURE flag to connect to the server?
I don't use WinAPI, only the purebasic network library functions.
And I don't know the SSL/TLS protocol (I don't know if it's even possible without API).
Posted: Thu Mar 29, 2007 11:54 am
by Kukulkan
gnozal wrote:I don't use WinAPI, only the purebasic network library functions.
And I don't know the SSL/TLS protocol (I don't know if it's even possible without API).
The SSL protocol is well known and documented all over the web, but it is a huge bunch of work to implement this by yourself. The windows-API provides all functions needed to connect using SSL if you are using InternetOpen_(), InternetOpenUrl_() and InternetReadFile_() to manage your connections (instead of the PB functions). Bad news is, that this will only work using windows.
Kukulkan