SENDMAIL SSL or TLS is not OK

Just starting out? Need help? Post your questions and find answers here.
al2791
User
User
Posts: 17
Joined: Mon Oct 23, 2017 7:28 am

SENDMAIL SSL or TLS is not OK

Post by al2791 »

Windows 11 PRO
Pb 6.01

I can't sent the mail 1) or 2)

Code: Select all

Mail_From$="xxx@gmail.com"
Mail_Pass$="*****"
Mail_To$="yyy@gmail.com"

If CreateMail(0, Mail_From$, "Hello")
    AddMailRecipient(0, Mail_To$, #PB_Mail_To)

     ; 1) ; Result = SendMail(0, "smtp.gmail.com", 465, #PB_Mail_UseSSL, Mail_From$, Mail_Pass$)
     ; or 2) ; 
    Result = SendMail(0, "smtp.gmail.com", 587, #PB_Mail_UseSMTPS, Mail_From$, Mail_Pass$)
     
   Repeat
    Progress = MailProgress(0)
    Delay(300)
   Until Progress = #PB_Mail_Finished Or Progress = #PB_Mail_Error
  
  If Progress = #PB_Mail_Finished
    MessageRequester("Information", "Mail correctly sent !")
  Else
    MessageRequester("Error", "Can't sent the mail !")
  EndIf   
EndIf

With parameters of Thunderbird, to send mail is OK
Server=smtp.gmail.com
Port=465
Sécurité de la connexion =SSL/TSL
Méthode d'authentification = OAuth2
Nom utilisateur=xxx@gmail.com

Do you know where is the proberm ?
Thank's
hoerbie
Enthusiast
Enthusiast
Posts: 119
Joined: Fri Dec 06, 2013 11:57 am
Location: DE/BY/MUC

Re: SENDMAIL SSL or TLS is not OK

Post by hoerbie »

From my understanding #PB_Mail_UseSMTPS should be used on port 465 and #PB_Mail_UseSSL on port 587 or 25.
User avatar
mk-soft
Always Here
Always Here
Posts: 5335
Joined: Fri May 12, 2006 6:51 pm
Location: Germany

Re: SENDMAIL SSL or TLS is not OK

Post by mk-soft »

You must also allow non-certified mail programs (such as your own APP) to send e-mails in the GMAIL settings (Online). Otherwise your mail will be rejected.
My Projects ThreadToGUI / OOP-BaseClass / EventDesigner V3
PB v3.30 / v5.75 - OS Mac Mini OSX 10.xx - VM Window Pro / Linux Ubuntu
Downloads on my Webspace / OneDrive
BarryG
Addict
Addict
Posts: 3292
Joined: Thu Apr 18, 2019 8:17 am

Re: SENDMAIL SSL or TLS is not OK

Post by BarryG »

Yep, port 587 for Gmail with SSL now. It used to be port 465, but Gmail changed it, so I had to change my port to match.
al2791
User
User
Posts: 17
Joined: Mon Oct 23, 2017 7:28 am

Re: SENDMAIL SSL or TLS is not OK

Post by al2791 »

I set up the gmail account :
- Enable two-step verification
- Generate application password.

Thanks for your help
ricardo
Addict
Addict
Posts: 2402
Joined: Fri Apr 25, 2003 7:06 pm
Location: Argentina

Re: SENDMAIL SSL or TLS is not OK

Post by ricardo »

mk-soft wrote: Tue Mar 21, 2023 7:55 pm You must also allow non-certified mail programs (such as your own APP) to send e-mails in the GMAIL settings (Online). Otherwise your mail will be rejected.

Hi,

I don't find this option
ARGENTINA WORLD CHAMPION
BarryG
Addict
Addict
Posts: 3292
Joined: Thu Apr 18, 2019 8:17 am

Re: SENDMAIL SSL or TLS is not OK

Post by BarryG »

ricardo wrote: Tue Apr 11, 2023 4:50 amI don't find this option
Read this -> https://support.google.com/mail/answer/185833?hl=en

It's what I had to do for my apps to send mail with Gmail.
ricardo
Addict
Addict
Posts: 2402
Joined: Fri Apr 25, 2003 7:06 pm
Location: Argentina

Re: SENDMAIL SSL or TLS is not OK

Post by ricardo »

BarryG wrote: Tue Apr 11, 2023 8:24 am
ricardo wrote: Tue Apr 11, 2023 4:50 amI don't find this option
Read this -> https://support.google.com/mail/answer/185833?hl=en

It's what I had to do for my apps to send mail with Gmail.
Thanks.


But it works sending emails from some domain .com
ARGENTINA WORLD CHAMPION
User avatar
mk-soft
Always Here
Always Here
Posts: 5335
Joined: Fri May 12, 2006 6:51 pm
Location: Germany

Re: SENDMAIL SSL or TLS is not OK

Post by mk-soft »

ricardo wrote: Tue Apr 11, 2023 1:47 pm But it works sending emails from some domain .com
The point is to send a mail. To do this, you have to log on to the mail server.
My Projects ThreadToGUI / OOP-BaseClass / EventDesigner V3
PB v3.30 / v5.75 - OS Mac Mini OSX 10.xx - VM Window Pro / Linux Ubuntu
Downloads on my Webspace / OneDrive
ricardo
Addict
Addict
Posts: 2402
Joined: Fri Apr 25, 2003 7:06 pm
Location: Argentina

Re: SENDMAIL SSL or TLS is not OK

Post by ricardo »

mk-soft wrote: Tue Apr 11, 2023 2:00 pm
ricardo wrote: Tue Apr 11, 2023 1:47 pm But it works sending emails from some domain .com
The point is to send a mail. To do this, you have to log on to the mail server.
Hi,

I do that, but does not use gmail, but one domain that i own. I create an email account and test this and it works perfectly, i even sent an attachment.
ARGENTINA WORLD CHAMPION
User avatar
mk-soft
Always Here
Always Here
Posts: 5335
Joined: Fri May 12, 2006 6:51 pm
Location: Germany

Re: SENDMAIL SSL or TLS is not OK

Post by mk-soft »

The security requirements are higher with gmail (which I also find good).
- You must have an app passport
- You must activate "imap access" under gmail settings (access Gmail with IMAP via other applications).
There you will also find the necessary settings for access.

I don't know what these settings look like in English (German here).
But I think it's good that non-certified mail programs don't have access to my account.
My Projects ThreadToGUI / OOP-BaseClass / EventDesigner V3
PB v3.30 / v5.75 - OS Mac Mini OSX 10.xx - VM Window Pro / Linux Ubuntu
Downloads on my Webspace / OneDrive
Post Reply