PureSMTP library : mail & attachments (AUTH supported)

All PureFORM, JaPBe, Libs and useful code maintained by gnozal

Moderator: gnozal

User avatar
DoubleDutch
Addict
Addict
Posts: 3220
Joined: Thu Aug 07, 2003 7:01 pm
Location: United Kingdom
Contact:

Post by DoubleDutch »

akj: can you link to an executable and its source.

Make sure you have the latest PB, the latest Pure_SMTP, AND the libs installed from www.PureBasic.com/beta

I will test it on a machine here that has Windows Me.

It may be a case that somehow your WindowsMe or PureBasic install has been corrupted.
https://deluxepixel.com <- My Business website
https://reportcomplete.com <- School end of term reports system
gnozal
PureBasic Expert
PureBasic Expert
Posts: 4229
Joined: Sat Apr 26, 2003 8:27 am
Location: Strasbourg / France
Contact:

Post by gnozal »

Update (both libs)

Changes :

- added function PureSMTP_SkipInitNetwork()
For free libraries and tools, visit my web site (also home of jaPBe V3 and PureFORM).
User avatar
DoubleDutch
Addict
Addict
Posts: 3220
Joined: Thu Aug 07, 2003 7:01 pm
Location: United Kingdom
Contact:

Post by DoubleDutch »

The links to your files on your page are going to a search panel at:
http://freenet-homepage.de

[edit]
Its working now... :)
https://deluxepixel.com <- My Business website
https://reportcomplete.com <- School end of term reports system
User avatar
DoubleDutch
Addict
Addict
Posts: 3220
Joined: Thu Aug 07, 2003 7:01 pm
Location: United Kingdom
Contact:

Post by DoubleDutch »

The fix for the library works great, thanks! :)
https://deluxepixel.com <- My Business website
https://reportcomplete.com <- School end of term reports system
akj
Enthusiast
Enthusiast
Posts: 668
Joined: Mon Jun 09, 2003 10:08 pm
Location: Nottingham

Post by akj »

DoubleDutch:

I do not understand your sentence "can you link to an executable and its source".

I have the latest version of PB and the beta updates installed and both PB and Windows ME are working fine.

I am using PureSMTP version 5.60 but I will retry my program with version 5.70 when I am back on that PC again.

If you could try on your ME machine I would be grateful as I really would like to use the PureSMTP library.
Anthony Jordan
User avatar
DoubleDutch
Addict
Addict
Posts: 3220
Joined: Thu Aug 07, 2003 7:01 pm
Location: United Kingdom
Contact:

Post by DoubleDutch »

akj:Do a test program that crashes on your ME system. If you give both the source and the executable, I will compile it as well (thats why we have to be in version sync) and compare the exe's (if yours crashes on my machine and mine does not) - there may be a difference that is resulting in the crash? By link to an executable I mean either PM it me or ftp it somewehre and provide a link to where it is.
https://deluxepixel.com <- My Business website
https://reportcomplete.com <- School end of term reports system
gnozal
PureBasic Expert
PureBasic Expert
Posts: 4229
Joined: Sat Apr 26, 2003 8:27 am
Location: Strasbourg / France
Contact:

Post 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.
For free libraries and tools, visit my web site (also home of jaPBe V3 and PureFORM).
akj
Enthusiast
Enthusiast
Posts: 668
Joined: Mon Jun 09, 2003 10:08 pm
Location: Nottingham

Post 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.]
Anthony Jordan
gnozal
PureBasic Expert
PureBasic Expert
Posts: 4229
Joined: Sat Apr 26, 2003 8:27 am
Location: Strasbourg / France
Contact:

Post 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())
For free libraries and tools, visit my web site (also home of jaPBe V3 and PureFORM).
gnozal
PureBasic Expert
PureBasic Expert
Posts: 4229
Joined: Sat Apr 26, 2003 8:27 am
Location: Strasbourg / France
Contact:

Post 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())
For free libraries and tools, visit my web site (also home of jaPBe V3 and PureFORM).
akj
Enthusiast
Enthusiast
Posts: 668
Joined: Mon Jun 09, 2003 10:08 pm
Location: Nottingham

Post 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().
Anthony Jordan
gnozal
PureBasic Expert
PureBasic Expert
Posts: 4229
Joined: Sat Apr 26, 2003 8:27 am
Location: Strasbourg / France
Contact:

Post 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.
For free libraries and tools, visit my web site (also home of jaPBe V3 and PureFORM).
citystate
Enthusiast
Enthusiast
Posts: 638
Joined: Sun Feb 12, 2006 10:06 pm

Post by citystate »

could someone supply a valid link to PureSMTP, all the ones I've followed timeout (including the one from PureArea)

Thanks
Matt
User avatar
GeoTrail
Addict
Addict
Posts: 2794
Joined: Fri Feb 13, 2004 12:45 am
Location: Bergen, Norway
Contact:

Post by GeoTrail »

Try a different browser!
I Stepped On A Cornflake!!! Now I'm A Cereal Killer!
citystate
Enthusiast
Enthusiast
Posts: 638
Joined: Sun Feb 12, 2006 10:06 pm

Post 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?)
Post Reply