SMTP Inconsistent result - ideas ?

SMTP Inconsistent result - ideas ?

Postby TimStone » Thu Oct 28, 2010 4:35 pm

First, I cannot provide a piece of code that reproduces this problem because it works fine on my computer. What I am seeking is ideas on where I can look on my clients computer to resolve this problem.

I have an element in my program that sends emails via SMTP. On my test machine it works perfectly. On some of my clients' computers it works fine.

With some of the computers, we see the "connected" message, but then when oMail:SendMail( ) , it may hang up because it apparently does not receive the response from the email server. Outlook, on that computer, configured the same way works perfectly.

I would assume the response may be getting blocked. Is there a port that might be blocked by a firewall ?

I really don't think this is a coding problem, but I would appreciate any ideas you share from your experiences.

I'm using xHarbour (.com) with FWH 10.6.
Tim Stone
http://www.MasterLinkSoftware.com
http://www.autoshopwriter.com
timstone@masterlinksoftware.com
Using: FWH 23.10 with Harbour 3.2.0 / Microsoft Visual Studio Community 2022-24 32/64 bit
User avatar
TimStone
 
Posts: 2909
Joined: Fri Oct 07, 2005 1:45 pm
Location: Trabuco Canyon, CA USA

Re: SMTP Inconsistent result - ideas ?

Postby James Bott » Thu Oct 28, 2010 6:02 pm

Tim,

Have you tried turning on oSocket:lDebug? This logs all the communications. I think you will have to modify TSMTP since it creates the socket object and there seems to be no way to turn on oSocked:lDebug without modifying the TSMTP source. It really should have its own switch.

Also, some SMTP servers require that you be logged into the internet on the same ISP or you cannot use the SMTP server.

Regards,
James
User avatar
James Bott
 
Posts: 4840
Joined: Fri Nov 18, 2005 4:52 pm
Location: San Diego, California, USA

Re: SMTP Inconsistent result - ideas ?

Postby James Bott » Thu Oct 28, 2010 11:22 pm

Duh...

oMail:oSocket:lDebug := .T.

Regards,
James

PS: I need a double shot latte...
User avatar
James Bott
 
Posts: 4840
Joined: Fri Nov 18, 2005 4:52 pm
Location: San Diego, California, USA

Re: SMTP Inconsistent result - ideas ?

Postby TimStone » Fri Oct 29, 2010 10:14 pm

James,

Lets connect one day and I'll buy you that Latte ...

Tim
Tim Stone
http://www.MasterLinkSoftware.com
http://www.autoshopwriter.com
timstone@masterlinksoftware.com
Using: FWH 23.10 with Harbour 3.2.0 / Microsoft Visual Studio Community 2022-24 32/64 bit
User avatar
TimStone
 
Posts: 2909
Joined: Fri Oct 07, 2005 1:45 pm
Location: Trabuco Canyon, CA USA

Re: SMTP Inconsistent result - ideas ?

Postby ukservice » Sun Oct 31, 2010 10:29 am

Timm

I suggest you this sample from asnker:

#Include "FiveWin.ch"

Function Main()
Local oEmailCfg,oEmailMsg

TRY
oEmailCfg := CREATEOBJECT( "CDO.Configuration" )
WITH OBJECT oEmailCfg:Fields
:Item( "http://schemas.microsoft.com/cdo/configuration/smtpserver" ):Value := "mail.xxxxxxxx.com"
:Item( "http://schemas.microsoft.com/cdo/configuration/smtpserverport" ):Value := 25
:Item( "http://schemas.microsoft.com/cdo/configuration/sendusing" ):Value := 2 // Remote SMTP = 2, local = 1
:Item( "http://schemas.microsoft.com/cdo/configuration/smtpauthenticate" ):Value := .T.
:Item( "http://schemas.microsoft.com/cdo/configuration/smtpusessl" ):Value := .F.
:Item( "http://schemas.microsoft.com/cdo/configuration/sendusername" ):Value := "xxanser@xxxxxxxx.com"
:Item( "http://schemas.microsoft.com/cdo/configuration/sendpassword" ):Value := "xxxxxx"
:Item( "http://schemas.microsoft.com/cdo/configuration/smtpconnectiontimeout"):Value := 30
:Update()
END WITH
CATCH oError
MsgInfo( "Could not create message configuration" + ";" + ;
"Error: " + TRANSFORM(oError:GenCode, NIL) + ";" + ;
"SubC: " + TRANSFORM(oError:SubCode, NIL) + ";" + ;
"OSCode: " + TRANSFORM(oError:OsCode, NIL) + ";" + ;
"SubSystem: " + TRANSFORM(oError:SubSystem, NIL) + ";" + ;
"Message: " + oError:Description )
Return .F.
END
oError:=NIL


TRY
oEmailMsg := CREATEOBJECT ( "CDO.Message" )
WITH OBJECT oEmailMsg
:Configuration = oEmailCfg
:From = chr(34)+" Anser K.K. "+chr(34)+ "<anser@xxxxxxxx.com>" // This will be displayed in the From (The email id does not appear)
:To = "xxanserkk@xxxxx.com" // <----- Place the TO email address
:Subject = "This is a Tst message"
:ReplyTo = "xxanser@xxxxxxxxx.com"
:Sender = "xxanser@xxxxxxxxx.com" // Read Receipt message is send to this
:Organization = "My xxxxxx Company" // "My Company Name"
:HTMLBody = "<HTML> Hello </HTML>"
:Send()
END WITH
SysRefresh()
CATCH oError

MsgInfo( "Could not send message" + ";" + CRLF+ ;
"Error: " + TRANSFORM(oError:GenCode, NIL) + ";" + CRLF+;
"SubC: " + TRANSFORM(oError:SubCode, NIL) + ";" + CRLF+ ;
"OSCode: " + TRANSFORM(oError:OsCode, NIL) + ";" + CRLF +;
"SubSystem: " + TRANSFORM(oError:SubSystem, NIL) + ";" +CRLF+ ;
"Message: " + oError:Description )
Return .F.

END
MsgInfo("Email Send")

Return
FWH 11.11, Harbour 3.1 and Borland C++ 5.82
User avatar
ukservice
 
Posts: 417
Joined: Tue Feb 23, 2010 3:09 pm
Location: John

Re: SMTP Inconsistent result - ideas ?

Postby TimStone » Thu Nov 11, 2010 12:13 am

By using the logging procedure I was finally able to see what was going on, and the error code returned by the system ... and resolve the problem.

Thanks for the suggestion.
Tim Stone
http://www.MasterLinkSoftware.com
http://www.autoshopwriter.com
timstone@masterlinksoftware.com
Using: FWH 23.10 with Harbour 3.2.0 / Microsoft Visual Studio Community 2022-24 32/64 bit
User avatar
TimStone
 
Posts: 2909
Joined: Fri Oct 07, 2005 1:45 pm
Location: Trabuco Canyon, CA USA


Return to FiveWin for Harbour/xHarbour

Who is online

Users browsing this forum: cmsoft and 42 guests