FiveTech Support Forums

FiveWin / Harbour / xBase community
Board index FiveWin for Harbour/xHarbour errsysw_prg send mail and port 110
Posts: 130
Joined: Sun Mar 08, 2009 04:33 PM
errsysw_prg send mail and port 110
Posted: Thu Sep 15, 2016 05:54 AM

HI,

I use errsysw_prg. Sending mail withaut SSL (as an error occurs in the application) does not work as it is by the provider of port 110 is required. Is there a way to sending mail server does not require an answer? Or the need to port 110?

Sory for may Englesh..

Regards,
Miloš Tajkov

FWHX 12.08
xHarbout bild 1.2.1

Best regards

Milos



[ FWH 21.11 ] [ xHarbour 1.2.3 Intl. (SimpLex) (Build 20150603) ]
Posts: 44162
Joined: Thu Oct 06, 2005 05:47 PM
Re: errsysw_prg send mail and port 110
Posted: Thu Sep 15, 2016 08:22 PM

Miloš,

Could you provide an example of what you are doing ? thanks

regards, saludos

Antonio Linares
www.fivetechsoft.com
Posts: 130
Joined: Sun Mar 08, 2009 04:33 PM
Re: errsysw_prg send mail and port 110
Posted: Fri Sep 16, 2016 06:19 AM
program error:



when I press Send errorlog:



program waits for a reply that did not receive, because it blocked port 110 with the provider. I just need to send mail without reading it. There is a way to change that or to enable change port for reading?

Regards,
Miloš
Best regards

Milos



[ FWH 21.11 ] [ xHarbour 1.2.3 Intl. (SimpLex) (Build 20150603) ]
Posts: 44162
Joined: Thu Oct 06, 2005 05:47 PM
Re: errsysw_prg send mail and port 110
Posted: Fri Sep 16, 2016 10:25 AM

Miloš,

Please post here the source code that you use to send the email

regards, saludos

Antonio Linares
www.fivetechsoft.com
Posts: 130
Joined: Sun Mar 08, 2009 04:33 PM
Re: errsysw_prg send mail and port 110
Posted: Sat Sep 17, 2016 05:52 PM
functuon SendEmail() from errsysw_.prg:

Code (fw): Select all Collapse
//-------------------------------------------------------------------------------

    static function SendEmail (cSubject, cBody, cMsg, oWnd, cImgFile)

      LOCAL oInit, oMail, aSet, i, lOk := .f.
      LOCAL lReceipt  := .f.
      LOCAL lAuth     := .f.
      LOCAL cFrom
      LOCAL aAttach
      LOCAL nPort := 25  // 587 (smtp-submission)

      DEFAULT cMsg := nil        //HTML Email

      aSet := ReadIni ()
      cFrom := TRIM (aSet[E_USER])+" <"+TRIM (aSet[E_FROM])+">"
      FOR i := 1 TO Len (aSet)
        lOk := !Empty (aSet[i])
        //? aSet[i]
      NEXT

//      ? cFrom + CRLF+;
//        aSet [E_LOGIN] + CRLF+;
//        aSet [E_PASS] + CRLF+;
//        aSet [E_SMTP]  + CRLF+;
//        aSet[E_TO]  + CRLF//+;


      IF ! lOk
        MsgAlert (  aLang[emailALERT1],  aLang[emailALERT2])
        RETURN (nil)
      ENDIF
      FErase ("Smtp.log")         // delete old logfile
      if file( cImgFile )
         aAttach := { cErrorPath+"error.log", cImgFile }
      else
         aAttach := { cErrorPath+"error.log" }
      endif

      oInit := TSmtp():New( aSet [E_SMTP] )
      oMail := TSmtp():New( aSet [E_SMTP], nPort, lAuth, aSet [E_LOGIN], aSet [E_PASS] ) // [jlalin], IBTC
      oMail:cReplyTo         :=  aSet[E_FROM] //aSet [E_REPLYTO] //cReplyTo
      oMail:nGMT             := 1   // 8 = Pacific Standard Time (GMT -08:00) - Adjust this to your own Time Zone!
      //oMail:lTxtAsAttach     := .F.         // uncomment to force txt, log and htm files as inline as opposed to attachement
      oMail:nDelay           := 2
      oMail:oSocket:lDebug   := .T.         // uncomment to create log file
      oMail:oSocket:cLogFile := "smtp.log"
      oMail:bConnecting      := {||MsgRun(  aLang[emailCONNECTING1] + aSet [E_SMTP] + " (" + oMail:cIPServer + ") "+ aLang[emailCONNECTING2]) }
      oMail:bConnected       := {||MsgRun (  aLang[emailCONNECTED] ) }
      oMail:SendMail( ;
            cFrom, ;                 // from/de
            { aSet[E_TO] }, ;        // to/para (arreglo) - I use cSender here also because it's an "autotest". Actually you would type a different address here
            cBody,;                  // Body/Mensaje
            cSubject,;               // Subject/Asunto
            aAttach, ;               //  Array of filenames to attach/Arreglo de nombres de archivos a agregar
            { }, ;                   // aCC
            {  }, ;                  // aBCC
            lReceipt, ;              // Return Receipt/acuse de recibo
            cMsg )                   // msg in HTML format/mensaje en HTML

      oInit:end()

   return (nil)


and email.ini:

Code (fw): Select all Collapse
[Email]
User=
Login=mtajkov@intersped.co.rs
Pass=********
Pop-Host=mail.intersped.co.rs
Smpt-Host=mail.intersped.co.rs
Leasedline=.F.
Autosave=.T.
Maildelete=.T.
ReplyTo=
MailTo=milos.tajkov@smartprint.co.rs


Regards,
Miloš
Best regards

Milos



[ FWH 21.11 ] [ xHarbour 1.2.3 Intl. (SimpLex) (Build 20150603) ]
Posts: 44162
Joined: Thu Oct 06, 2005 05:47 PM
Re: errsysw_prg send mail and port 110
Posted: Tue Sep 20, 2016 10:46 AM

Please use this function to send the emails:

viewtopic.php?p=114169#p114169

regards, saludos

Antonio Linares
www.fivetechsoft.com
Posts: 130
Joined: Sun Mar 08, 2009 04:33 PM
Re: errsysw_prg send mail and port 110
Posted: Tue Oct 04, 2016 07:10 AM
Hi,

I tried all the examples but without success :-) . Now I'm trying to gmail account. This account works with microsoft outlook.

Code (fw): Select all Collapse
FUNCTION PosMail()

local lRet := .f.
local oCfg, oError

local cServ := "smtp.gmail.com" 
local nPort := "465"
local lAut := .t.
local lSSL := .t.
local cPass := "*******"
local cTo := "milos.tajkov@smartprint.co.rs"
local cCC := "mtajkov@intersped.co.rs"
local cBCC := "mtajkov@intersped.co.rs"


cUser := Alltrim("mtajkov@gmail.com") 
cRemt := Alltrim("mtajkov@gmail.com") 

TRY
oCfg := CREATEOBJECT( "CDO.Configuration" )
WITH OBJECT oCfg:Fields
:Item( "http://schemas.microsoft.com/cdo/configuration/smtpserver" ):Value := cServ
:Item( "http://schemas.microsoft.com/cdo/configuration/smtpserverport" ):Value := val(nPort)
:Item( "http://schemas.microsoft.com/cdo/configuration/sendusing" ):Value := 2
:Item( "http://schemas.microsoft.com/cdo/configuration/smtpauthenticate" ):Value := lAut
:Item( "http://schemas.microsoft.com/cdo/configuration/smtpusessl" ):Value := lSSL
:Item( "http://schemas.microsoft.com/cdo/configuration/sendusername" ):Value := cUser
:Item( "http://schemas.microsoft.com/cdo/configuration/sendpassword" ):Value := cPass
:Update()
END WITH
lRet := .t.
CATCH oError
MsgInfo( "Nao Foi possível Enviar o e-Mail!" +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+ ;
"Mensaje: " + oError:Description, "Atençao" )
END

////////////////////////

*cTo := Destinatarios( cTo ) //--> PARA
*cCC := Destinatarios( cCC ) //--> COM COPIA
*cBCC := Destinatarios( cBCC ) //--> COM COPIA OCULTA

TRY
oMsg := CREATEOBJECT ( "CDO.Message" )
WITH OBJECT oMsg
:Configuration = oCfg
:From = cFrom
:To = cTo
:CC = cCC
:BCC = cBCC

:Subject = cSubject
:TextBody = cMsg
For x := 1 To Len( cAttach )
if cAttach[x] <> NIL
:AddAttachment(cAttach[x])
endif
Next

MsgInfo("Saljem")
:Send()
END WITH
lRet := .t.


CATCH
lRet := .f.
END


Do you maybe someone knows what's the problem?

Regards,
Miloš
Best regards

Milos



[ FWH 21.11 ] [ xHarbour 1.2.3 Intl. (SimpLex) (Build 20150603) ]

Continue the discussion