Bad Email Dreams ...

Re: Bad Email Dreams ...

Postby nnicanor » Thu May 31, 2012 4:15 am

TIm,

Change this line:


If LEN(ALLTRIM(TABMAIL[06])) > 0
:AddAttachment := AllTrim( TABMAIL[06] )
ENDIF

for


If LEN(ALLTRIM(TABMAIL[06])) > 0
:AddAttachment( AllTrim( TABMAIL[06] ) )
ENDIF

Same code works in harbour and xharbour

Regards,
Nicanor Martinez M.
Auditoria y Sistemas Ltda.
MicroExpress Ltda.
FW + FWH + XHARBOUR + HARBOUR + PELLES C + XDEVSTUDIO + XEDIT + BCC + VC_X86 + VCC_X64 + MINGW + R&R Reports + FastReport + Tdolphin + ADO + MYSQL + MARIADB + ORACLE
nnicanor@yahoo.com
nnicanor
 
Posts: 302
Joined: Fri Apr 23, 2010 4:30 am
Location: Colombia

Re: Bad Email Dreams ...

Postby TimStone » Thu May 31, 2012 1:24 pm

After making the change, I get error 1, SubC: 1068, OSCode 0 SubSystem BASE Message Argument error
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: 2945
Joined: Fri Oct 07, 2005 1:45 pm
Location: Trabuco Canyon, CA USA

Re: Bad Email Dreams ...

Postby nnicanor » Thu May 31, 2012 1:42 pm

Tim

Which info do you have in TABMAIL[06] ? if file found ?


Regards,
Nicanor Martinez M.
Auditoria y Sistemas Ltda.
MicroExpress Ltda.
FW + FWH + XHARBOUR + HARBOUR + PELLES C + XDEVSTUDIO + XEDIT + BCC + VC_X86 + VCC_X64 + MINGW + R&R Reports + FastReport + Tdolphin + ADO + MYSQL + MARIADB + ORACLE
nnicanor@yahoo.com
nnicanor
 
Posts: 302
Joined: Fri Apr 23, 2010 4:30 am
Location: Colombia

Re: Bad Email Dreams ...

Postby TimStone » Thu May 31, 2012 2:03 pm

06 refers to the attachements. I tried two tests. The first was to send the name of an existing file in the directory, and it is there. The second was to send a "" value for the file name. Thus The LEN should evaluate to 0 and :AddAttachment should not be called. In both cases I do a messageinfo( ) to display the content and it is correct.

I am sending this as a string. With SMTP we have to pass an array of string values,

Also, this is using Harbour. With xHarbour, the implementation works fine as is. However, I'm trying to complete a move to Harbour and MSVC.

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: 2945
Joined: Fri Oct 07, 2005 1:45 pm
Location: Trabuco Canyon, CA USA

Re: Bad Email Dreams ...

Postby Antonio Linares » Thu May 31, 2012 3:49 pm

Tim,

have you tried FWH\samples\TestMail.prg ? Here it works very fine...
regards, saludos

Antonio Linares
www.fivetechsoft.com
User avatar
Antonio Linares
Site Admin
 
Posts: 42122
Joined: Thu Oct 06, 2005 5:47 pm
Location: Spain

Re: Bad Email Dreams ...

Postby TimStone » Thu May 31, 2012 4:12 pm

Antonio,

As noted earlier in this thread, I previously used FWH SMTP. I had no problems with it, and it still works for me. However we have major issues with ISPs, and so it doesn't work for some of my clients. It does not get a response from the email server. Being able to email documents is very important in my application, so I must have the ability to do attachments.

I can't resolve problems because on my own system there has never been a problem. On the ones where people do have problems, its with our SMTP, but their Outlook, for example, may work just fine with the same settings.

Thats why it gives me "bad dreams"

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: 2945
Joined: Fri Oct 07, 2005 1:45 pm
Location: Trabuco Canyon, CA USA

Re: Bad Email Dreams ...

Postby nnicanor » Thu May 31, 2012 7:09 pm

Tim i'm using MSVC and no problem, i'm going to compile your code later to find error. do you have an example calling this function ?

Regards

Nicanor
Nicanor Martinez M.
Auditoria y Sistemas Ltda.
MicroExpress Ltda.
FW + FWH + XHARBOUR + HARBOUR + PELLES C + XDEVSTUDIO + XEDIT + BCC + VC_X86 + VCC_X64 + MINGW + R&R Reports + FastReport + Tdolphin + ADO + MYSQL + MARIADB + ORACLE
nnicanor@yahoo.com
nnicanor
 
Posts: 302
Joined: Fri Apr 23, 2010 4:30 am
Location: Colombia

Re: Bad Email Dreams ...

Postby nnicanor » Thu May 31, 2012 10:10 pm

Tim,

With xHarbour and Harbour i get errors, i know where is your problem, you are using same parameter for Autentication and SSL, should be logical .T. or .F. i dont know wich type are you using when call function.

Code: Select all  Expand view  RUN

 With Object oCfg:Fields
      :Item( "http://schemas.microsoft.com/cdo/configuration/smtpserver" ):Value := Trim(TABMAIL[01])
      :Item( "http://schemas.microsoft.com/cdo/configuration/smtpserverport" ):Value := TABMAIL[11] // nPort
      :Item( "http://schemas.microsoft.com/cdo/configuration/sendusing" ):Value :=  2
      :Item( "http://schemas.microsoft.com/cdo/configuration/smtpauthenticate" ):Value :=[color=#FF0000]TABMAIL[13][/color] // lauth

      IF LEN(ALLTRIM(TABMAIL[09])) > 0
         :Item( "http://schemas.microsoft.com/cdo/configuration/sendusername" ):Value := Trim( TABMAIL[09] )
         :Item("http://schemas.microsoft.com/cdo/configuration/sendpassword" ):Value := Trim( TABMAIL[10] )
      ENDIF
      :Item( "http://schemas.microsoft.com/cdo/configuration/smtpusessl" ):Value := [color=#FF0000]TABMAIL[13] // cssl
      :Update()
   End With
 


And this is modified code tested with Gmail.

Code: Select all  Expand view  RUN


//-----------------------------------//

FUNCTION SMTPMAILS(TABMAIL)
Local oCfg, oMsg, oError,cToken, ;
      nEle     := 1, ;
      dBcc     := SPACE(1000)


DEFAULT Tabmail := { "smtp.gmail.com" ,;
                     "youremail@gmail.com",;
                     "your_friend@anyserver.com",;
                     "Test from Tim Function ",;
                     "This is a test no answer",;
                     "c:\jmbbackup\barranquilla.pdf",;
                     "",;
            .t.,;
           "youremaail@gmail.com",;
           "YourPassWord",;
                   465,;
                   "",;
                  .t.,;
                  "",;
                  "" }


/* Tabmail

01 = MAILSERVER
02 = MAILFROM
03 = MAILTO
04 = SUBJECT
05 = BODY
06 = ATTACHMENT
07 = BCC
08 = LAUTHORIZATION
09 = USERID pour MAILSERVER
10 = PW     pour MAILSERVER
11 = Mail port   defaut = 25
12 = Mail HTML page
13 = ssl authentification
14 = Mail sender
15 = Organisation sender

*/


IF TABMAIL[11] = 0 // PORT
   TABMAIL[11] := 25
ENDIF

Try
   oCfg := CreateObject( "CDO.Configuration" )

   With Object oCfg:Fields

      :Item( "http://schemas.microsoft.com/cdo/configuration/smtpserver" ):Value       := Trim(TABMAIL[01])
      :Item( "http://schemas.microsoft.com/cdo/configuration/smtpserverport" ):Value   := TABMAIL[11] // nPort
      :Item( "http://schemas.microsoft.com/cdo/configuration/sendusing" ):Value        :=  2 //
      :Item( "http://schemas.microsoft.com/cdo/configuration/smtpauthenticate" ):Value := TABMAIL[08] // lauth

      IF LEN(ALLTRIM(TABMAIL[09])) > 0
         :Item( "http://schemas.microsoft.com/cdo/configuration/sendusername" ):Value  := Trim( TABMAIL[09] )
         :Item("http://schemas.microsoft.com/cdo/configuration/sendpassword" ):Value   := Trim( TABMAIL[10] )
      ENDIF

      :Item( "http://schemas.microsoft.com/cdo/configuration/smtpusessl" ):Value       := TABMAIL[13] // cssl

      :Update()
     
   End With

   SYSREFRESH()
   
   oMsg := CreateObject( "CDO.Message" )

   With Object oMsg
 
      :Configuration := oCfg
      :From          := Trim( TABMAIL[02] )
      :To            := Trim( TABMAIL[03] )
      :ReplyTo       := TABMAIL[14]
      :Subject       := Trim( TABMAIL[04] )
      :Sender        := TABMAIL[14] // Read Receipt message is send to this
      :Organization  := TABMAIL[15] // "My Company Name"

      :TextBody      := Trim( TABMAIL[05] )

      IF LEN(ALLTRIM(TABMAIL[12])) > 0
         :HTMLBody   := MEMOREAD(TABMAIL[12])
      ENDIF

      If LEN(ALLTRIM(TABMAIL[06])) > 0
         :AddAttachment( AllTrim( TABMAIL[06] ) ) // := AllTrim( TABMAIL[06] )
      ENDIF

      If LEN(TABMAIL[07]) > 0
         FOR nEle = 1 to LEN(TABMAIL[07])
            IF nEle = 1
               Dbcc := ALLTRIM(TABMAIL[07][1])
             ELSE
               DBCC := ALLTRIM(DBCC) + "," + ALLTRIM(TABMAIL[07][nEle])
            ENDIF
         NEXT
         :BCC := Trim(DBCC )
      EndIf

      :Send()

   End With
   SysRefresh()
   Catch oError
     cErrores:=  "No se pudo enviar el mensaje" + CRLF  + "Error: " + cValToChar( oError:GenCode) + CRLF + ;
               "SubC: " + cValToChar( oError:SubCode ) + CRLF + "OSCode: " + cValToChar( oError:OsCode ) + CRLF + ;
               "SubSystem: " + cValToChar( oError:SubSystem ) + CRLF + "Mensaje: " + oError:Description +" "+ if( ! Empty( oError:FileName ),;
                    ": " + oError:FileName   ,;
                    if( !Empty( oError:Operation ),;
                        ": " + oError:Operation   ,;
                        "" ) )+CRLF

      n := 2    // we don't disscard any info again !

      while ( n < 74 )
          if ! Empty( ProcName( n ) )
             cErrores := CRLF+cErrores+"   Called from: " + ProcFile( n ) + " => " + Trim( ProcName( n ) ) + ;
                           "(" + NTRIM( ProcLine( n ) ) + ")"

          endif
          n++
      end
     
      msginfo( cErrores )
     
   oCfg := Nil
   oMsg := Nil
   Return( .F. )
End Try


oCfg := Nil
oMsg := Nil
SYSREFRESH()
Return( .T. )

 



Regards,
Nicanor Martinez M.
Auditoria y Sistemas Ltda.
MicroExpress Ltda.
FW + FWH + XHARBOUR + HARBOUR + PELLES C + XDEVSTUDIO + XEDIT + BCC + VC_X86 + VCC_X64 + MINGW + R&R Reports + FastReport + Tdolphin + ADO + MYSQL + MARIADB + ORACLE
nnicanor@yahoo.com
nnicanor
 
Posts: 302
Joined: Fri Apr 23, 2010 4:30 am
Location: Colombia

Re: Bad Email Dreams ...

Postby TimStone » Fri Jun 01, 2012 8:24 pm

I made the changes but can't get a build right now. I'm running into a different problem.

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: 2945
Joined: Fri Oct 07, 2005 1:45 pm
Location: Trabuco Canyon, CA USA

Re: Bad Email Dreams ...

Postby Rick Lipkin » Thu Jun 07, 2012 9:32 pm

Tim

Did you solve your SMTP e-mail problems .. I was thinking about using CDO, but from the research I have been doing, CDO is not a component loaded on every Windows OS ??

Correct me if I am wrong ?

Thanks
Rick Lipkin
User avatar
Rick Lipkin
 
Posts: 2666
Joined: Fri Oct 07, 2005 1:50 pm
Location: Columbia, South Carolina USA

Re: Bad Email Dreams ...

Postby TimStone » Thu Jun 07, 2012 9:53 pm

I did use the CDO solution and it works here.

Of course the SMTP solution also worked here.

I'm on Win 7 and it has not difficulty in the default install / setup.
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: 2945
Joined: Fri Oct 07, 2005 1:45 pm
Location: Trabuco Canyon, CA USA

Re: Bad Email Dreams ...

Postby nnicanor » Fri Jun 08, 2012 3:22 am

I confirm CDO works also in Window 8 beta and last preview Release, tested and working fine.

Regards,
Nicanor Martinez M.
Auditoria y Sistemas Ltda.
MicroExpress Ltda.
FW + FWH + XHARBOUR + HARBOUR + PELLES C + XDEVSTUDIO + XEDIT + BCC + VC_X86 + VCC_X64 + MINGW + R&R Reports + FastReport + Tdolphin + ADO + MYSQL + MARIADB + ORACLE
nnicanor@yahoo.com
nnicanor
 
Posts: 302
Joined: Fri Apr 23, 2010 4:30 am
Location: Colombia

Re: Bad Email Dreams ...

Postby kokookao2007 » Mon Dec 10, 2012 10:14 am

hi TimStone :

The 32bit .exe for borland Compiler,

I test a CDO with Attach files solution for WIN7(64bit/32bit).

1) don't double click the .exe file.
2) don't Put .exe file in Current Directory , put it in difference Directory Path
3) Write A batch file and Launch the Batch file(or link file)
---------
#Dump call_exe.bat(in Current Directory)
start .\exe_file\TESTMAIL.EXE
#END DUMP
-----------
I test it work Fine for :
Win7(32bit)+ office 2003+cdo
Win7(32bit)+ office 2007
Win7(32bit)+ office 2010(32bit)
Win7(64bit)+ office 2007(32bit)
Win7(64bit)+ office 2010(32bit)
Win7(64bit)+ office 2010(64bit)

In Win8 you can double click the .exe file and work Fine.
I didn't try FWH64.

--
Best Regards
--------------------------------------------------------------
kokoo KAO
-------------
best regards
kokoo Kao
User avatar
kokookao2007
 
Posts: 59
Joined: Thu May 17, 2007 8:27 am

Re: Bad Email Dreams ...

Postby TimStone » Wed Dec 19, 2012 4:01 am

Randal,

I downloaded today the Catalyst trial version. I saw your DLL listing elsewhere.

Could you provide us with a sample of how you implemented this DLL ? Also you reference the LIB calls. Did you link in the LIB's that are included into your build ? I've got a build with xHarbour that uses Peles C, and one with MSVC 2010 which I know is supposed to be compatible with Catalyst.

In your notes you indicate you set this up for SSL. Their samples are a bit limited for what I'm trying to discover.

Your guidance would be greatly appreciated. Sadly many of the servers today want SSL and our TSMTP protocol in FWH does not support it.

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: 2945
Joined: Fri Oct 07, 2005 1:45 pm
Location: Trabuco Canyon, CA USA

Re: Bad Email Dreams ...

Postby James Bott » Sun Dec 23, 2012 4:24 pm

Tim,

After reading this thread, it sounds like most of the problems you are having are related to the SMTP setup--not the software's capabilities (with the exception of the SSL issue).

Can you give us some examples of SMTP servers that users are having problems with? I mean just the names of the servers like AOL, Hotmail, Cox, etc.

Note that only premium Yahoo accounts (paid) have SMTP access--free accounts don't. At least this was true the last time I checked which was a couple of years ago.

Near as I can tell, gmail accounts require SSL, but I have seen a reference to turning off this requirement. Turning it off would be an option although a much better option would be to have SSL capabilities in our FW TMail class.

Attachments ALWAYS have to include the COMPLETE PATH including the drive.

When you say everything always works for you, do you mean you are actually able to send to your client's SMTP server but they are not? Have you confirmed you are both using the same parameters? I know this can be touchy since you will need their password to test the system, but they could always change it while you test, then restore the original one.

You program could be getting blocked by their firewall.

You can find a lot of SMTP server's setup parameters on the net such as:

http://www.c3sd.com/email_servers_ports.php

http://www.emailaddressmanager.com/tips/mail-settings.html

You might consider including a list of common email servers for users to select from. Behind the scenes you would already have the setup parameters for each server in a file. Thus all the user does is select a server and add their username and password. This would prevent a lot of confusion.

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

PreviousNext

Return to FiveWin for Harbour/xHarbour

Who is online

Users browsing this forum: No registered users and 44 guests