FiveTech Support Forums

FiveWin / Harbour / xBase community
Board index FiveWin for Harbour/xHarbour Trapping SMTP e-mail error
Posts: 44158
Joined: Thu Oct 06, 2005 05:47 PM
Trapping SMTP e-mail error
Posted: Tue Oct 07, 2008 08:52 PM
Rick,

Please change bFailure this way:
oOutMail:bFailure := { | oSocket, nError, cReply | LogFile( "log.txt", { nError, "--", cReply, ProcName( 2 ) } ), oOutMail:nStatus := 7 }

Please change the 2 value in the ProcName() call so you get the proper method name, so we locate where Method Failure() has been called from, thanks
regards, saludos

Antonio Linares
www.fivetechsoft.com
Posts: 2706
Joined: Fri Oct 07, 2005 01:50 PM
Trapping SMTP e-mail error
Posted: Tue Oct 07, 2008 09:16 PM
Antonio

Here are your results ..

Rick

10/07/2008 17:14:46: 0	--	550	TSMTP:ONREAD	
10/07/2008 17:14:56: 10048	--		TSMTP:ONCONNECT
Posts: 44158
Joined: Thu Oct 06, 2005 05:47 PM
Trapping SMTP e-mail error
Posted: Tue Oct 07, 2008 09:30 PM

Rick,

It seems there is an error caused for a second try to connect to the same address:

http://support.ipswitch.com/kb/WSK-19980701-EM03.htm

regards, saludos

Antonio Linares
www.fivetechsoft.com
Posts: 2706
Joined: Fri Oct 07, 2005 01:50 PM
Trapping SMTP e-mail error
Posted: Tue Oct 07, 2008 11:08 PM

Antonio

I have a instinctive feeling the port was not getting close on ( the first ) failure .. .. that is my guess ..

I am not a guru on the code .. is there a way you can look and see if the origional error actually closes the port ??

Thanks
Rick

Posts: 4840
Joined: Fri Nov 18, 2005 04:52 PM
Trapping SMTP e-mail error
Posted: Wed Oct 08, 2008 12:50 AM

Rick,

Logfile() is a FW function and may also be called from TSocket which is called by TSMTP. It is called if oSocket:lDebug == .t. I don't know if it is set to .T. when it is being used by TSMTP.

Or, maybe you are using Logfile() somewhere else in your program?

For a quick test, you could try changing the filename passed to LogFile() to a different name other than "logfile.txt" and see if you still get the same two errors logged.

James

FWH 18.05/xHarbour 1.2.3/BCC7/Windows 10
Posts: 2706
Joined: Fri Oct 07, 2005 01:50 PM
Trapping SMTP e-mail error
Posted: Wed Oct 08, 2008 01:10 AM

James

I think what is happening is that when the e-mail fails .. the SMTP port is not being closed properly .. so when I come back and re-run the same code and send another e-mail .. we get the open port error .. I think this is a 'bug' somewhere in Tsmtp .. I just don't know where to look :(

Rick

Posts: 4840
Joined: Fri Nov 18, 2005 04:52 PM
Trapping SMTP e-mail error
Posted: Wed Oct 08, 2008 01:17 AM

Rick,

Just add an oMail:oSocket:end() after sending the mail to test if this is the problem.

James

FWH 18.05/xHarbour 1.2.3/BCC7/Windows 10
Posts: 4840
Joined: Fri Nov 18, 2005 04:52 PM
Trapping SMTP e-mail error
Posted: Wed Oct 08, 2008 01:20 AM

Rick,

>.. is there a way you can look and see if the origional error actually closes the port ??

Yes, it does. See TSMTP method Failure().

James

FWH 18.05/xHarbour 1.2.3/BCC7/Windows 10
Posts: 4840
Joined: Fri Nov 18, 2005 04:52 PM
Trapping SMTP e-mail error
Posted: Wed Oct 08, 2008 01:23 AM

Rick,

For more testing try turning on the logfile() in oSocket.

define mail oMail...

oMail:oSocket:cLogfile:="socket.log"
oMail:oSocket:lDebug:=.t.

James

FWH 18.05/xHarbour 1.2.3/BCC7/Windows 10
Posts: 44158
Joined: Thu Oct 06, 2005 05:47 PM
Trapping SMTP e-mail error
Posted: Sun Oct 12, 2008 05:51 PM

Rick,

Do you properly send emails with authentification ?

regards, saludos

Antonio Linares
www.fivetechsoft.com
Posts: 2706
Joined: Fri Oct 07, 2005 01:50 PM
Trapping SMTP e-mail error
Posted: Sun Oct 12, 2008 06:37 PM

Antonio

I see where you published the Tsmtp ( failure ) modification in ver 810 .. thank you .. did you also include the mods for the attachments ??

As far as your question on 'authindication' .. I am a bit confused on the context of your question :? ( ok .. just read the other smtp post .. getting up to speed here )

Our Agency Enterprise e-mail system is Novell GroupWise ( mapi .. don't confuse that with smtp ) and our address book is published ( as I understand it ) thru both GroupWise and available thru our ( additional smtp ) LDAP... I hope I am correct in my explaination here.

Just a side note here .. the reason I do not use mapi .. I just don't feel comfortable GroupWise will be our e-mail standard as we are moviing closer to MS Exchange. I chose SMTP as my choice because SMTP will still be around long after GroupWise or Exchange...

Our SMTP is only intranet or internal to our Agency ( some 7k users ) .. the problem I am running into with Tsmtp is when ( within my application ) a user mis-spells a userid within our 'domain' and when I fire off an e-mail .. if the address lookup fails in SMTP .. it just fails and I need a way to trap that in order to recover and to write the failure to a log to be able to review and fix.

Tsmtp just seems to return the error from SMTP ( which is ok ) and we need to find out if Failure() does indeed close the port or if the program trace for the second failure is actually routed thru Failure () .. hense the different failure codes ..

I can not ( to my knowledge ) pre-test or 'authendicate' a valid e-mail address ( unless you have a way I can pre-test the existance of a valid address ?? ) ..

I need to download the latest 8.10 and look at it .. what do I need to change to send with authendication ??

Rick

Posts: 44158
Joined: Thu Oct 06, 2005 05:47 PM
Trapping SMTP e-mail error
Posted: Sun Oct 12, 2008 07:18 PM

Rick,

>
I see where you published the Tsmtp ( failure ) modification in ver 810 .. thank you .. did you also include the mods for the attachments ??
>

We included the most recent Class TSmtp that we got, but we may be missing the attachments mods.

Regarding "authentification", I asked you as it was asked in http://forums.fivetechsoft.com/viewtopic.php?t=13068 and I wonder if you could help each other.

regards, saludos

Antonio Linares
www.fivetechsoft.com
Posts: 2706
Joined: Fri Oct 07, 2005 01:50 PM
Trapping SMTP e-mail error
Posted: Sun Oct 12, 2008 07:32 PM

Antonio

I just e-mailed you the attachment mod fix that Tim Stone so graciously sent me.

I will look at the authendication thread and see if we can share our experiences.

Thanks
Rick

Posts: 2706
Joined: Fri Oct 07, 2005 01:50 PM
Trapping SMTP e-mail error
Posted: Sun Oct 12, 2008 08:10 PM

To All watching the two Tsmtp threads .. here is the cross post I just made:

http://www.fivetechsoft.com/forums/view ... 6762#66762

Rick

Continue the discussion