Bad Email Dreams ...

User avatar
TimStone
Posts: 2536
Joined: Fri Oct 07, 2005 1:45 pm
Location: Trabuco Canyon, CA USA
Contact:

Bad Email Dreams ...

Post by TimStone »

For several years I have used SMTP so my clients can send emails. It works fine for me, and for many others, but on too many, it won't work. My guess is their service provider blocks the response, so the program never actually sends the email.

So, I decided to just insist they have an email client setup, and I would use MAPI.

If I use the code:
ACTION winexec( "rundll32.exe url.dll, FileProtocolHandler mailto:support@masterlinksoftware.com")
It will work fine. The problem is that I want to send attachements and I don't believe this method allows for that possibility.

So I tried the FWH tMail option. I'm using Office Outlook 2010, so when I run it, I get a message that Outlook is not my default email service ( it is ), so it can't run the request.

I've tried all types of SMTP. It just isnt working in all cases. I can't solve the problem because of course it works fine on all my test machines.

Does anyone have suggestions ?
1) How to extend my working line of code to include attachements, or
2) How to get tMail to work with Outlook 2010 ( or is it a Win7 issue ? ).

Thanks

Tim
Tim Stone
http://www.MasterLinkSoftware.com
timstone@masterlinksoftware.com
Using: FWH 19.06 with Harbour 3.2.0 / Microsoft Visual Studio Community 2019
User avatar
codemaker
Posts: 208
Joined: Wed Dec 03, 2008 4:48 pm
Location: Belgrade, Serbia

Re: Bad Email Dreams ...

Post by codemaker »

MAybe to try See32 library?

We are using this library for so many years and works perfect. We can send attachments.

The user must setup their mail server credentials (Smnp server, username, password, port) and this is it
Carlos Mora
Posts: 988
Joined: Thu Nov 24, 2005 3:01 pm
Location: Madrid, España

Re: Bad Email Dreams ...

Post by Carlos Mora »

Hi Tim,

May be CDOSys could handle it. It's included with every Win since 2000 Server, and works with ssl and attachments, and non convencional account like google or yahoo ones.
Saludos
Carlos Mora
http://harbouradvisor.blogspot.com/
StackOverflow http://stackoverflow.com/users/549761/carlos-mora
“If you think education is expensive, try ignorance"
User avatar
TimStone
Posts: 2536
Joined: Fri Oct 07, 2005 1:45 pm
Location: Trabuco Canyon, CA USA
Contact:

Re: Bad Email Dreams ...

Post by TimStone »

Thanks for the responses.

I'm still curious why the tMail option is not working with Office 2010 ( or is it a Windows 7 problem ? ).

Is there a fix ?

Tim
Tim Stone
http://www.MasterLinkSoftware.com
timstone@masterlinksoftware.com
Using: FWH 19.06 with Harbour 3.2.0 / Microsoft Visual Studio Community 2019
nnicanor
Posts: 296
Joined: Fri Apr 23, 2010 4:30 am
Location: Colombia

Re: Bad Email Dreams ...

Post by nnicanor »

Tim

Cdossys is easy and works fine i can send atachments and html body, i tested with FWH for xHarbour and Harbour compiled with MVC, BCC and Mingw.


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
User avatar
TimStone
Posts: 2536
Joined: Fri Oct 07, 2005 1:45 pm
Location: Trabuco Canyon, CA USA
Contact:

Re: Bad Email Dreams ...

Post by TimStone »

Are there any samples of using cDosSys ? From what I see on the internet searches, it is designed for web based apps.

Tim
Tim Stone
http://www.MasterLinkSoftware.com
timstone@masterlinksoftware.com
Using: FWH 19.06 with Harbour 3.2.0 / Microsoft Visual Studio Community 2019
Gale FORd
Posts: 663
Joined: Mon Dec 05, 2005 11:22 pm
Location: Houston
Contact:

Re: Bad Email Dreams ...

Post by Gale FORd »

I have had really good luck with a SMTP Component from Ostrosoft. It is free for non-commercial license.
You only need to copy and register 1 dll file.
http://www.ostrosoft.com/OSSMTP6.asp
If you are interested, let me know and I will send or post some sample code. It is really fast and reliable.
nnicanor
Posts: 296
Joined: Fri Apr 23, 2010 4:30 am
Location: Colombia

Re: Bad Email Dreams ...

Post by nnicanor »

Tim,

This is my modified cdosys functions, you may to define a dbf to save config, for config use femail( cAlias ) parameter can be an alias or data object like dolphin query o tdabase object.

use config alias ... new ... shared ......

Femail( "config")

or

use config alias ...... new shared.
database oConfig

Femail( OConfig")

using tdolphin

oConfig := oServer:Query("Select * from config")

Femail( oConfig")

TO send mail use function Envia_Email( cFgAlias, cTo , cBcc, cSubJect, cAttach ) ..


Code: Select all


#INCLUDE "FIVEWIN.CH"
#include "recursos.ch"
#include "CdoSys.ch"
#include "hbcompat.ch"

#ifndef _CDOSYS_CH
#define _CDOSYS_CH
#define cdoSMTPServer            "http://schemas.microsoft.com/cdo/configuration/smtpserver"
#define cdoSMTPServerPort        "http://schemas.microsoft.com/cdo/configuration/smtpserverport"
#define cdoSendUsing             "http://schemas.microsoft.com/cdo/configuration/sendusing"
#define cdoSMTPPickupFolder      "http://schemas.microsoft.com/cdo/configuration/smtpserverpickupdirectory"
#define cdoSMTPAuthenticate      "http://schemas.microsoft.com/cdo/configuration/smtpauthenticate"
#define cdoSendUserName          "http://schemas.microsoft.com/cdo/configuration/sendusername"
#define cdoSendPassword          "http://schemas.microsoft.com/cdo/configuration/sendpassword"
#define cdoSMTPUseSSL            "http://schemas.microsoft.com/cdo/configuration/smtpusessl"
#define cdoSMTPConnectionTimeout "http://schemas.microsoft.com/cdo/configuration/smtpconnectiontimeout"
#endif
 //20Us3rP4l3rm011
#define NTRIM(n)    ( LTrim( Str( n ) ) )

#define WS_3DLOOK  4
#define CLR_HBROWN nRGB( 205, 192, 176 )
#define CLR_NBLUE  nRGB( 142, 171, 194 )

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

FUNCTION str_replace(cString, cFind, cReplace )
Local cStr,nPos,nTot,cToc1,cToc2

  nPos := AT( upper(cFind), upper(cString) )
  nTot := len( cFind )

  if nPos > 0

     cToc1 := Substr( cString, 1, nPos-1 )
     cToc2 := Substr( cString, nPos + nTot + 1 )

     cStr  := cToc1+cReplace+cToc2

  else

     cStr := cString

  endif

Return cStr

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

Function fEmail_config( cFgAlias )

   Local oDlg, aCtl[ 22 ], oFont,lOk:=.f.

   Local cMailServer := PadR( "tuservidordecorreo.com", 60 ), ;             // servidor de correo
         cFrom       := PadR( "tucuenta@tuservidor.com", 60 ), ;        // remitente
         cTo         := PadR( "", 180 ), ; // destinatario (uno o varios separados con comas)
         cBCC        := PadR( "", 180 ), ; // copias ocultas a (uno o varios separados con comas)
         cAttach     := PadR( "", 2048 ), ;// archivo anexo (uno o varios separados con comas)
         cSubject    := "Informes Vencimiento Documentos "+Dtoc(Date())+" "+time(), ;                              // asunto
         cBody       := "Notificacion automatica de Vencimientos "+CRLF+CRLF+"Sistema de Control", ;                             // cuerpo del mensaje
         nPort       := 25 ,; //465, ;                                      // puerto usado por el servidor de correo // 465 si es Gmail
         cUser       := Space( 60 ), ;                              // nombre de usuario para autenticación 
         cPass       := Space( 30 )                                          // contraseña para autenticación

IF valtype( cFgAlias )=="C"

   cMailServer := ( cFgAlias )->CSERVER
   cFrom       := ( cFgAlias )->CFROM
   cTo         := ( cFgAlias )->CTO
   cBCC        := ( cFgAlias )->CCC
   cSubJect    := ( cFgAlias )->CSUBJECT
   nPort       := ( cFgAlias )->NPORT
   cUser       := ( cFgAlias )->CUSER
   cPass       := ( cFgAlias )->CPASS
   cBody       := ( cFgAlias )->CBODY

Else

   cMailServer := cFgAlias:CSERVER
   cFrom       := cFgAlias:CFROM
   cTo         := cFgAlias:CTO
   cBCC        := cFgAlias:CCC
   cSubJect    := cFgAlias:CSUBJECT
   nPort       := cFgAlias:NPORT
   cUser       := cFgAlias:CUSER
   cPass       := cFgAlias:CPASS

ENDIF


//   DEFINE FONT oFont NAME "Arial" SIZE 0, -16

    oFont := TFont():New( GetDefaultFontName(), 0, GetDefaultFontHeight(),, )

   DEFINE DIALOG oDlg FROM 0, 0 TO 455, 703 PIXEL FONT oFontb ;
          COLORS CLR_BLUE, CLR_HBROWN ;
          TITLE "Configuracion Servidor de Envio de Informes para empresas" ;
          STYLE nOR( DS_MODALFRAME, WS_POPUP, WS_CAPTION, WS_SYSMENU, WS_3DLOOK )

   @ 10,  5 SAY aCtl[ 1 ] PROMPT "Servidor de Correo:" OF oDlg ;
            FONT oFont UPDATE ;
            COLORS CLR_BLUE, CLR_HBROWN SIZE 70, 11 PIXEL

   @ 10, 80 GET aCtl[ 2 ] VAR cMailServer OF oDlg ;
            FONT oFont  UPDATE  PICTURE "@K" ;
            COLORS CLR_BLUE, CLR_WHITE SIZE 206, 11 PIXEL

   @ 10,294 SAY aCtl[ 3 ] PROMPT "Puerto:" OF oDlg ;
            FONT oFont UPDATE ;
            COLORS CLR_BLUE, CLR_HBROWN SIZE 30, 11 PIXEL

   @ 10,320 GET aCtl[ 4 ] VAR nPort OF oDlg ;
            FONT oFont  UPDATE  PICTURE "@K ####" ;
            COLORS CLR_BLUE, CLR_WHITE SIZE 24, 11 PIXEL

   @ 24,  5 SAY aCtl[ 5 ] PROMPT "Remitente:" OF oDlg ;
            FONT oFont UPDATE ;
            COLORS CLR_BLUE, CLR_HBROWN SIZE 70, 11 PIXEL

   @ 24, 80 GET aCtl[ 6 ] VAR cFrom OF oDlg ;
            FONT oFont  UPDATE  PICTURE "@K" ;
            COLORS CLR_BLUE, CLR_WHITE SIZE 264, 11 PIXEL

   @ 39,  5 SAY aCtl[ 7 ] PROMPT "Destinatario:" OF oDlg ;
            FONT oFont UPDATE ;
            COLORS CLR_BLUE, CLR_HBROWN SIZE 70, 11 PIXEL

   @ 39, 80 GET aCtl[ 8 ] VAR cTo OF oDlg ;
            FONT oFont  UPDATE  PICTURE "@K" ;
            COLORS CLR_BLUE, CLR_WHITE SIZE 264, 11 PIXEL

   @ 54,  5 SAY aCtl[ 9 ] PROMPT "Copia para:" OF oDlg ;
            FONT oFont UPDATE ;
            COLORS CLR_BLUE, CLR_HBROWN SIZE 70, 11 PIXEL

   @ 54, 80 GET aCtl[ 10 ] VAR cBCC OF oDlg ;
            FONT oFont  UPDATE  PICTURE "@K" ;
            COLORS CLR_BLUE, CLR_WHITE SIZE 264, 11 PIXEL

   @ 69,  5 SAY aCtl[ 11 ] PROMPT "Adjuntar:" OF oDlg ;
            FONT oFont UPDATE ;
            COLORS CLR_BLUE, CLR_HBROWN SIZE 70, 11 PIXEL

   @ 69, 80 GET aCtl[ 12 ] VAR cAttach OF oDlg  PICTURE "@K" ;
            FONT oFont  UPDATE ;
            COLORS CLR_BLUE, CLR_WHITE SIZE 253, 11 PIXEL // ACTION fAddAttach( aCtl[ 12 ] ) ; // descomentar para FWH 8.12 o posterior

   @ 69,333 BUTTON "..." OF oDlg SIZE 10, 10 PIXEL ACTION fAddAttach( aCtl[ 12 ] )

   @ 84,  5 SAY aCtl[ 13 ] PROMPT "Asunto:" OF oDlg ;
            FONT oFont UPDATE ;
            COLORS CLR_BLUE, CLR_HBROWN SIZE 70, 11 PIXEL

   @ 84, 80 GET aCtl[ 14 ] VAR cSubject OF oDlg ;
            FONT oFont  UPDATE PICTURE "@K" ;
            COLORS CLR_BLUE, CLR_WHITE SIZE 264, 11 PIXEL

   @ 99,  5 SAY aCtl[ 15 ] PROMPT "Autenticación: Usuario:" OF oDlg ;
            FONT oFont UPDATE ;
            COLORS CLR_BLUE, CLR_HBROWN SIZE 80, 11 PIXEL

   @ 99, 87 GET aCtl[ 16 ] VAR cUser OF oDlg ;
            FONT oFont  UPDATE PICTURE "@K" ;
            COLORS CLR_BLUE, CLR_WHITE SIZE 118, 11 PIXEL

   @ 99,213 SAY aCtl[ 17 ] PROMPT "Contraseña:" OF oDlg ;
            FONT oFont UPDATE ;
            COLORS CLR_BLUE, CLR_HBROWN SIZE 44, 11 PIXEL

   @ 99,259 GET aCtl[ 18 ] VAR cPass OF oDlg PASSWORD ;
            FONT oFont  UPDATE  PICTURE "@K";
            COLORS CLR_BLUE, CLR_WHITE SIZE 85, 11 PIXEL

   @118,  6 SAY aCtl[ 19 ] PROMPT "Cuerpo del mensaje" OF oDlg ;
            SIZE 100, 11 PIXEL ;
            FONT oFont COLORS CLR_BLUE, CLR_HBROWN

   @126, 10 GET aCtl[ 20 ] VAR cBody OF oDlg ;
            FONT oFont MULTILINE  UPDATE ;
            COLORS CLR_BLUE, CLR_WHITE SIZE 330, 72 PIXEL

   @208,213 BUTTON aCtl[ 21 ] PROMPT "&Grabar" OF oDlg ;
            FONT oFont SIZE 53, 16 PIXEL  ;
            ACTION ( lok:=.t.,oDlg:End() )

   @208,292 BUTTON aCtl[ 22 ] PROMPT "&Salir" OF oDlg ;
            FONT oFont SIZE 53, 16 PIXEL ACTION oDlg:End()

   ACTIVATE DIALOG oDlg CENTERED ;
            VALID ( oFont:End(), .T. )

   IF lok == .t.

     IF valtype( cFgAlias ) == "C"

      ( cFgAlias )->( NET_READ() )

      ( cFgAlias )->CSERVER  := cMailServer
      ( cFgAlias )->CFROM    := cFrom
      ( cFgAlias )->CTO      := cTo
      ( cFgAlias )->CCC      := cBCC
      ( cFgAlias )->CSUBJECT := cSubJect
      ( cFgAlias )->NPORT    := nPort
      ( cFgAlias )->CUSER    := cUser
      ( cFgAlias )->CPASS    := cPass
      ( cFgAlias )->CBODY    := cBody

      ( cFgAlias )->( DBRUNLOCK() )

     ELSE

       cFgAlias:CSERVER := cMailServer
       cFgAlias:CFROM   := cFrom
       cFgAlias:CTO     := cTo
       cFgAlias:CCC     := cBCC
       cFgAlias:CSUBJECT:= cSubJect
       cFgAlias:NPORT   := nPort
       cFgAlias:CUSER   := cUser
       cFgAlias:CPASS   := cPass
       cFgAlias:CBODY   := cBody

       cFgAlias:Save()

     Endif

     if msgnoyes("Desea Comprobar el envio ahora ?")

              Envia_Email( cFgAlias, cTo , cBcc, cSubJect, cAttach )

         //fSendMail( cMailServer, cFrom, cTo, cSubject, cBody, cAttach, cBCC, cUser, cPass, nPort )

     Endif


    ENDIF

Return Nil

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

Function Envia_Email( cFgAlias, cTo1, cBcc1, cSubject1, cAttach1, cBody1,cDatos )

Local cMailServer,;
      cFrom      ,;
      cTo        ,;
      cBCC       ,;
      cSubJect   ,;
      nPort      ,;
      cUser      ,;
      cPass      ,;
      cBody

    IF valtype( cFgAlias ) == "C"

      cMailServer := ( cFgAlias )->CSERVER
      cFrom       := ( cFgAlias )->CFROM
      cTo         := ( cFgAlias )->CTO
      cBCC        := ( cFgAlias )->CCC
      cSubJect    := ( cFgAlias )->CSUBJECT
      nPort       := ( cFgAlias )->NPORT
      cUser       := ( cFgAlias )->CUSER
      cPass       := ( cFgAlias )->CPASS
      cBody       := ( cFgAlias )->CBODY

   else

      cMailServer := cFgAlias:CSERVER
      cFrom       := cFgAlias:CFROM
      cTo         := cFgAlias:CTO
      cBCC        := cFgAlias:CCC
      cSubJect    := cFgAlias:CSUBJECT
      nPort       := cFgAlias:NPORT
      cUser       := cFgAlias:CUSER
      cPass       := cFgAlias:CPASS
      cBody       := cFgAlias:CBODY

   ENDIF

     DEFAULT cTo1      := cTo
     DEFAULT cSubject1 := cSubject
     DEFAULT cBody1    := cBody
     DEFAULT cAttach1  := ""
      DEFAULT cBcc1     := cBcc

     fSendMail( cMailServer, cFrom, cTo1, cSubject1, cBody1, cAttach1, cBCC1, cUser, cPass, nPort, cDatos )

Return

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

Function fSendMail( cMailServer, cFrom, cTo, cSubject, cBody, cAttach, cBCC, cUser, cPass, nPort, cDatos )

   Local oCfg, oMsg, oError, nEle, cToken, ;
         aAttach  := {}, ;
         lAuth    := ! Empty( cUser ) .and. ! Empty( cPass ), ;
         nSendOpt := 2   // send using: 1 = pickup folder  2 = port

   Default nPort    := 25, ;
           cSubject := "", ;
           cBody    := "", ;
              cDatos   := "Sin datos que mostrar",;
              cBcc     :="",;
              cUser    :="",;
              cPass    :=""


   cBody := str_replace( cBody, "\DATOS\", cDatos )

   If "GMAIL.COM" $ Upper( cMailServer ) .and. ( Empty( cUser ) .or. Empty( cPass ) )
      MsgStop( "Con GMail son requeridos nombre de usuario y contraseña", "Atención" )
      Return Nil
   EndIf

   CursorWait()

   nEle := 1

   While ! Empty( cToken := StrToken( cAttach, nEle++, "," ) )
      AAdd( aAttach, cToken )
   EndDo

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

      With Object oCfg:Fields
         :Item( cdoSMTPServer ):Value     := Trim( cMailServer )
         :Item( cdoSMTPServerPort ):Value := nPort
         :Item( cdoSendUsing ):Value      := nSendOpt

         If lAuth
            :Item( cdoSMTPAuthenticate ):Value := 1
            :Item( cdoSendUserName ):Value     := Trim( cUser )
            :Item( cdoSendPassword ):Value     := Trim( cPass )
            :Item( cdoSMTPUseSSL ):Value       := 1
         EndIf

         :Update()

      End With

      oMsg := CreateObject( "CDO.Message" )

      With Object oMsg
         :Configuration := oCfg
         :From          := Trim( cFrom )
         :To            := Trim( cTo )
         :Subject       := Trim( cSubject )
         :TextBody      := Trim( cBody )
         //:MDNRequested  := .T.  // confirmacion de recibido
         //:HTMLBody      := strHTML

         For nEle := 1 To Len( aAttach )
            :AddAttachment( AllTrim( aAttach[ nEle ] ) ) // := AllTrim( aAttach[ nEle ] )
         Next

         If ! Empty( cBCC )
            :BCC := Trim( cBCC )
         EndIf

         :Send()
      End With

   Catch oError

      CursorArrow()

      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

      ??? cErrores

      oCfg := Nil
      oMsg := Nil
      Return Nil

   End Try

   oCfg := Nil
   oMsg := Nil
   SndPlaySound( GetWinDir() + "\media\Tada.wav", 0 )
   CursorArrow()

Return Nil

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

Static Function fAddAttach( oGet )

   Local cFile, ;
         cAttach := oGet:VarGet()

   cFile := cGetFile( "*.*", "Selecciona el archivo" )

   If ! Empty( cFile )
      cAttach := Lower( PadR( AllTrim( cAttach ) + If( ! Empty( cAttach ), ",", "" ) + AllTrim( cFile ), 2048 ) )
   EndIf

   oGet:cText( cAttach )

Return Nil

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

            

Last edited by nnicanor on Tue May 15, 2012 3:46 pm, edited 2 times in total.
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
Gale FORd
Posts: 663
Joined: Mon Dec 05, 2005 11:22 pm
Location: Houston
Contact:

Re: Bad Email Dreams ...

Post by Gale FORd »

If you are using Outlook 2007 or later then CDO does not get installed automatically. You have to install it as a stand alone product.
This page may help. http://j-integra.intrinsyc.com/support/ ... ?id=113792
User avatar
TimStone
Posts: 2536
Joined: Fri Oct 07, 2005 1:45 pm
Location: Trabuco Canyon, CA USA
Contact:

Re: Bad Email Dreams ...

Post by TimStone »

Nicanor,

I will try it but my concern is the SMTP protocal. It works fine for me here, but fails on some of my clients systems. That is the problem I am fighting.

Gale, its Free for NON-COMMERCIAL use but my application is being sold commercially.

Tim
Tim Stone
http://www.MasterLinkSoftware.com
timstone@masterlinksoftware.com
Using: FWH 19.06 with Harbour 3.2.0 / Microsoft Visual Studio Community 2019
User avatar
TimStone
Posts: 2536
Joined: Fri Oct 07, 2005 1:45 pm
Location: Trabuco Canyon, CA USA
Contact:

Re: Bad Email Dreams ...

Post by TimStone »

Gale,

That download requires Outlook ( Office ) 2007 and will not work with 2010. It could be "tricked" but Microsoft does not recommend it.

Its interesting how MAILTO will trigger the MAPI Outlook client without a problem, but it, of course, doesn't support attachments.
I need a solution that works for all versions of Outlook, or another email client.

Tim
Tim Stone
http://www.MasterLinkSoftware.com
timstone@masterlinksoftware.com
Using: FWH 19.06 with Harbour 3.2.0 / Microsoft Visual Studio Community 2019
nnicanor
Posts: 296
Joined: Fri Apr 23, 2010 4:30 am
Location: Colombia

Re: Bad Email Dreams ...

Post by nnicanor »

Tim i am using cdossys with an reserved account in my company server or an autenticated account with gmail an no problem.

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
User avatar
TimStone
Posts: 2536
Joined: Fri Oct 07, 2005 1:45 pm
Location: Trabuco Canyon, CA USA
Contact:

Re: Bad Email Dreams ...

Post by TimStone »

I think the problem is with our service providers. I believe they like to do data mining on all emails going through their system, so they block direct connections to other servers. Some providers have an alternative port that allows us to bypass it, but others I believe block the return even on the alternate port. Consequently we get no response from the server ( some locations ) and the email hangs up.

In other cases, I believe the malware software is not properly set, but I don't have control over this.

Thats why MAPI seems to be a better option, and also the emails are saved both ways, but newer versions of Office do not behave well with it.

Tim
Tim Stone
http://www.MasterLinkSoftware.com
timstone@masterlinksoftware.com
Using: FWH 19.06 with Harbour 3.2.0 / Microsoft Visual Studio Community 2019
Gale FORd
Posts: 663
Joined: Mon Dec 05, 2005 11:22 pm
Location: Houston
Contact:

Re: Bad Email Dreams ...

Post by Gale FORd »

If you are using Outlook 2010 you can use the Outlook object model directly . The only problem with that is the security pop-up. You can get a free utility (mapilabs) that can bypass the security pop-up, but the Outlook object model is much slower than other approaches.

Quick example without error checking.

Code: Select all

#define olMailItem 0  // Mail object
      oOutlook = CREATEOBJECT( "Outlook.Application" )
      oMail = oOutlook:CreateItem( olMailItem )
      oMail:Recipients:Add( 'test@mycompany.com' )
      oMail:Attachments:Add(  "c:\xharbour\test.htm" )
      oMail:Subject = 'Hello'

      // oMail:Body = "This is a test." // Text only body
      oMail:HTMLBody = MEMOREAD( "c:\xharbour\test.htm" )
      oMail:Display = .T.
      oMail:send()

 
User avatar
TimStone
Posts: 2536
Joined: Fri Oct 07, 2005 1:45 pm
Location: Trabuco Canyon, CA USA
Contact:

Re: Bad Email Dreams ...

Post by TimStone »

Gale your code generates:

Error description: Error Outlook.Application:CREATEITEM:ATTACHMENTS/87 E_INVALIDARG: ADD
Tim Stone
http://www.MasterLinkSoftware.com
timstone@masterlinksoftware.com
Using: FWH 19.06 with Harbour 3.2.0 / Microsoft Visual Studio Community 2019
Post Reply