Hola Franco
Pero el problema está cuando intentamos mandar un e-mail desde nuestra
aplicación se produce un Error porque no están otorgados los permiso
a la cta. del remitente, pero como conseguir que obtenga permiso
el usuario de nuestra aplicación ?
Saludos
*---------------------------------------------------------------------------------*
Hello Franco
But the problem is when we try to send an e-mail from our
Application fails because the permissions are not granted
to the cta. sender, but how to get permission
the user of our application?
Regards
Mustafa
framework para HMG
Moderator: Rathinagiri
- danielmaximiliano
- Posts: 2625
- Joined: Fri Apr 09, 2010 4:53 pm
- Location: Argentina
- Contact:
Re: framework para HMG
Hola Mustafá: mi inconveniente no es conectarme con Gmail o otros servidores de correo mediante POP3 no de enviar mediante smtp.
La seguridad de IMAPs es con respecto a la autentificación de usuarios mediante la API de Gmail. Esto se Lee aquí.
https://developers.google.com/gmail/ima ... 2-protocol
La seguridad de IMAPs es con respecto a la autentificación de usuarios mediante la API de Gmail. Esto se Lee aquí.
https://developers.google.com/gmail/ima ... 2-protocol
*´¨)
¸.·´¸.·*´¨) ¸.·*¨)
(¸.·´. (¸.·` *
.·`. Harbour/HMG : It's magic !
(¸.·``··*
Saludos / Regards
DaNiElMaXiMiLiAnO
Whatsapp. := +54901169026142
Telegram Name := DaNiElMaXiMiLiAnO
¸.·´¸.·*´¨) ¸.·*¨)
(¸.·´. (¸.·` *
.·`. Harbour/HMG : It's magic !
(¸.·``··*
Saludos / Regards
DaNiElMaXiMiLiAnO
Whatsapp. := +54901169026142
Telegram Name := DaNiElMaXiMiLiAnO
Re: framework para HMG
Hello all.
this is what I use out of all my programs. Started from an example by Rathi I believe
You must have a gmail account with security allow less secure apps set to to Y
I only use this email address for sending emails. I have forward incoming mail set to another email account.
I compile with batch file c:\3.44\build c:\email\cdo in the c:\email\cdo folder. CDO.PRG
I hope this will work for you.
this is what I use out of all my programs. Started from an example by Rathi I believe
You must have a gmail account with security allow less secure apps set to to Y
I only use this email address for sending emails. I have forward incoming mail set to another email account.
I compile with batch file c:\3.44\build c:\email\cdo in the c:\email\cdo folder. CDO.PRG
Code: Select all
#include "hmg.ch"
Function Main
*** You could put for sm_to and sm_body below ---- sm_to := inputbox("Enter To EmailAddress") and sm_body := inputbox{"Enter Message")
Local cPath:= GetCurrentFolder()+"\", loCfg, loMsg
Local sm_to:= "email address where you want to send to "
Local sm_from:= "your email address" (with security turned to less secure programs)
Local sm_cc:=""
Local sm_bcc:=""
Local sm_userauth:= "your email address"
Local sm_passauth:= "your password for above email address"
Local sm_subject:="Direct Email. "
Local sm_servsmtp:="smtp.gmail.com"
Local sm_portsmtp:=465
Local sm_confirm_read:=.T.
Local sm_Body:='<html><head><meta content="text/html; charset=utf-8" http-equiv="content-type"><title></title></head><body>'+;
'htThis is sent through (CREATEOBJECT), (GOES THOUGH MICROSOFT SCHEMAS)</body></html>'
Local sm_TextBody:="This is sent through new direct mail out of program. When in invoice click email if customer has email in his file it sends."
Local lSSL:=.T.
Local sm_priority:=1
Local sm_att:= cPath+"AttSample.zip"
#xcommand TRY => BEGIN SEQUENCE WITH {|o| break(o)}
#xcommand CATCH [<!oErr!>] => RECOVER [USING <oErr>] <-oErr->
#xcommand FINALLY => ALWAYS
//Please note, when using the :AddAttachment method in your scripts you must use a fully qualified pathname as the argument to the method. Using //just a file name or a relative path will produce the error The specified protocol is unknown
//By repeating the :AddAttachment method you can attach more than one file.
//sm_priority:=2 is for High; =1 for Normal; =0 for Low
//sm_confirm_read:=.T. is for return receipt
TRY
loCfg := CREATEOBJECT( "CDO.Configuration" )
WITH OBJECT loCfg:Fields
:Item( "http://schemas.microsoft.com/cdo/configuration/smtpserver" ) :Value := sm_servsmtp
:Item( "http://schemas.microsoft.com/cdo/configuration/smtpserverport" ) :Value := sm_portsmtp
:Item( "http://schemas.microsoft.com/cdo/configuration/sendusing" ) :Value := 2
:Item( "http://schemas.microsoft.com/cdo/configuration/smtpauthenticate" ):Value := .T.
:Item( "http://schemas.microsoft.com/cdo/configuration/smtpusessl" ) :Value := lSSL
:Item( "http://schemas.microsoft.com/cdo/configuration/sendusername" ) :Value := sm_userauth
:Item( "http://schemas.microsoft.com/cdo/configuration/sendpassword" ) :Value := sm_passauth
:Update()
END WITH
loMsg := CREATEOBJECT ( "CDO.Message" )
WITH OBJECT loMsg
:BodyPart:Charset := "utf-8"
:Configuration := loCfg
:From := sm_from
:To := sm_to
:Subject := sm_subject
:Bcc := sm_bcc
:Cc := sm_cc
:TextBody := sm_TextBody //plain text
:HTMLBody := sm_Body //html text
:HTMLBodyPart:Charset := "utf-8"
:AddAttachment (sm_att)
WITH OBJECT loMsg:Fields
:Item("urn:schemas:httpmail:importance"):Value := sm_priority
:Item("urn:schemas:mailheader:X-Priority"):Value := sm_priority-1
IF sm_confirm_read
:Item("urn:schemas:mailheader:return-receipt-to"):Value := sm_from
:Item("urn:schemas:mailheader:disposition-notification-to"):Value := sm_from
ENDIF
:Update()
ENDWITH
:DSNOptions := 0
:Send()
MsgInfo('Success')
ENDWITH
CATCH oError
MsgStop ( "The email was not sent."+CRLF+;
"Error: "+TRANSFORM(oError:GenCode, NIL)+CRLF+;
"SubCode: "+TRANSFORM(oError:SubCode, NIL)+CRLF+;
"OSCode: "+TRANSFORM(oError:OsCode, NIL)+CRLF+;
"SubSystem: "+TRANSFORM(oError:SubSystem, NIL)+CRLF+;
"Description: "+oError:Description)
END
RETURN
*********************************************************************************
All The Best,
Franco
Canada
Franco
Canada
Re: framework para HMG
Martin, maybe you are using the wrong demo.martingz wrote: ↑Thu Aug 20, 2020 7:00 pm Pcmodula, use it, but when I compile my program the rpt file is included in the exe, when I make a modification and launch the report from my application it always executes the old one, I have to compile again and my now if it shows with the changes, I can't find The last one I did, there I already had a preview of the report and it was more finished.
Now that I finally have my pc available, I suggest you try C:\MiniGui\SAMPLES\Advanced\REPORT_GENERATOR_2, it allows you to change the report without recompiling, just edit the rpt file and it works with Miniprint, hbprinter, pdfprint, html!
Last thing, with the latest version you need to replace gete("os") with hb_GetEnv ("OS") into STATIC ChangeFunc () ,otherwise it goes wrong (I have already reported this to Grigory)
Best Regards
Pcmodula