FiveTech Support Forums

FiveWin / Harbour / xBase community
Board index FiveWin for Harbour/xHarbour Sample working send mail
Posts: 340
Joined: Thu Jan 25, 2007 03:53 PM
Sample working send mail
Posted: Tue May 17, 2022 10:23 AM

Ciao all

I HAVE NO PROBLEM IF I USE THE BELOW SAMPLE USING PEC MAIL

BUT I GOT ERROR IF I WISH TO USE IT USING NO PEC MAIL, LIKE GMAIL (EXAMPLE)

PLEASE CAN U TELL ME WHAT IS WRONG ?

OR CAN U SEND ME A SMAL EXAMPLE TO SEND MAIL USING NO PEC (OR ALSO PEC)

GRAZIE !!!!

**** SHORT EXAMPLE ****

function mail_dct(_from,_to,_password,_subject,_textbody,_arrattach,_smtpserver)
LOCAL oEmailMsg
LOCAL cSchema := "http://schemas.microsoft.com/cdo/configuration/"
LOCAL _lok:=.t.,_j,_cfile

b_oxon(10,"Inviando mail...")
oEmailMsg := CREATEOBJECT ( "CDO.Message" )

  WITH OBJECT oEmailMsg


     :From     := alltrim(_from)
     :To       := alltrim(_to)

     :CC       := ""
     :BCC      := ""

     :Subject  := _subject
     :TextBody := _textbody

     :AddAttachment( ALLTRIM( "c:\test0.prg" ) )

     WITH OBJECT :configuration:Fields

        :Item( cSchema + "smtpserver" ):Value       := alltrim(_smtpserver)

        :Item( cSchema + "smtpserverport" ):Value   := 465

        :Item( cSchema + "sendusing" ):Value        := 2
        :Item( cSchema + "smtpauthenticate" ):Value := .T.

        :Item( cSchema + "smtpusessl" ):Value       := .T.
  • only for pec mail :Item( cSchema + "sendtls" ):Value := .T.
    :Item( cSchema + "sendtls" ):Value := .F.
        :Item( cSchema + "sendusername" ):Value     := alltrim(_from)
        :Item( cSchema + "sendpassword" ):Value     := alltrim(_password)
        :Item( cSchema + "smtpconnectiontimeout"):Value := 30
    
        :Update()
    
     END WITH
    

:Send()
END WITH
RETURN nil

Posts: 340
Joined: Thu Jan 25, 2007 03:53 PM
Re: Sample working send mail
Posted: Tue May 17, 2022 01:20 PM

It is strange:

If i use my second mail on tiscali.it it works

Then smtp.tiscali.it works fine for my secondary mail

But smtp.gmailcom doesnt work for my primary mail

It seems that gmail has changed something

Any help on that ?

Grazie

Posts: 8515
Joined: Tue Dec 20, 2005 07:36 PM
Re: Sample working send mail
Posted: Tue May 17, 2022 01:34 PM
João Santos - São Paulo - Brasil - Phone: +55(11)95150-7341
Posts: 340
Joined: Thu Jan 25, 2007 03:53 PM
Re: Sample working send mail
Posted: Tue May 17, 2022 04:35 PM

I tried it

It doenst work for gmail

Maybe because i have Harbout and not xHarbour ?

Posts: 340
Joined: Thu Jan 25, 2007 03:53 PM
Re: Sample working send mail
Posted: Tue May 17, 2022 04:47 PM

My version of FWH is 16.02

:-(

Posts: 8515
Joined: Tue Dec 20, 2005 07:36 PM
Re: Sample working send mail
Posted: Tue May 17, 2022 05:29 PM
https://myaccount.google.com/lesssecureapps?pli=1&rapt=AEjHL4OVmY-ApGYbOoTh57mwGNggo1-hllqACXg8qD_BYdX3CYAn6MNk4CuR95yFG6zcVwUbGvcv3ni1RwKHy_uI_pyZuw5SWA

It will be increasingly difficult to use gmail.com. You don't have a paid account with another provider? The Fivewin version is irrelevant. Although the sooner you upgrade to a more modern version, the better.

Cada vez será más difícil usar gmail.com. ¿No tienes una cuenta paga con otro proveedor? La versión de Fivewin es irrelevante. Aunque cuanto antes actualices a una versión más moderna, mejor.

Regards, saludos.
João Santos - São Paulo - Brasil - Phone: +55(11)95150-7341
Posts: 1772
Joined: Thu Sep 05, 2019 05:32 AM
Re: Sample working send mail
Posted: Wed May 18, 2022 06:16 AM
hi,

i do not use GMail so i can not test it

in Express++ Forum "seems" have a Solution using "UNSAFE APPS" in Settings of the GMAIL account.
http://bb.donnay-software.com/donnay/phpbb3/viewtopic.php?f=15&t=2954&p=18050

but they talk about : this feature expires on 31 May 2022

it seems you have to make new "2-Step Verification" and uses the App Password instead of his GMail Account Password.
greeting,

Jimmy
Posts: 340
Joined: Thu Jan 25, 2007 03:53 PM
Re: Sample working send mail
Posted: Wed May 25, 2022 10:26 AM

it really seems doesnt exist a simple solution to continue use gmail mail by fwh

;-(

grazie anyhow

Posts: 1515
Joined: Thu Oct 30, 2008 02:37 PM
Re: Sample working send mail
Posted: Wed May 25, 2022 10:29 AM

Hi,

1st. Error description
2nd. ...

Regards

Posts: 40
Joined: Fri Aug 22, 2014 06:21 AM
Re: Sample working send mail
Posted: Fri May 27, 2022 11:04 AM

One possibility is to install Thunderbird on the user's pc and activate a gmail account.
You send the e-mail as you always have, which is to gmail, and Thunderbird takes care of the rest.

https://support.mozilla.org/en-US/kb/th ... -and-gmail

Posts: 1598
Joined: Fri Oct 07, 2005 05:56 PM
Re: Sample working send mail
Posted: Wed Jun 01, 2022 03:00 PM
Regards,

Dutch



FWH 2304 / xHarbour Simplex 1.2.3 / BCC73 / Pelles C / UEStudio

FWPPC 10.02 / Harbour for PPC (FTDN)

ADS V.9 / MySql / MariaDB

R&R 12 Infinity / Crystal Report XI R2

(Thailand)
Posts: 300
Joined: Wed Jul 11, 2007 11:06 AM
Re: Sample working send mail
Posted: Thu Jun 02, 2022 12:48 PM

Hello,
I try this and it is working fine with GMAIL .

Try this, hope may help.

viewtopic.php?f=3t=41496start=15

Have a good day

Philippe

&&

Continue the discussion