Quantcast
Channel: WinDev Forum
Viewing all articles
Browse latest Browse all 1914

WB20: gmail doesn't send (anymore) (1 reply)

$
0
0
Hello,

I have a procedure to send email with a google account and used the example from webdev help. But it doesn't work.

The message i recieve is:

The last response of SMTP server is:
<534-5.7.14 <[accounts.google.com]
534-5.7.14 MVQzqM7HjDuOgtGdCdtkfhibPH-yPzN8k3rdYb55DaHbfC9Lfy5OvoRC-JNctjYN1HPZpq
534-5.7.14 pIo-RtRkDt1eHnEYFa1oY451DqxjJgeze2BuT41JxyC3I7B-PR30I2doOywJl_ah5HPfSi
534-5.7.14 ASm_JbDBkMYy6odgNR6hpaRezxrh2d_Od_IGt_ejsSvwb9ubkILXPRol_EsJnqrDpLUMpa
534-5.7.14 a3m8vmkUyqHCLdz0mprE4Bl1iR8aE> Please log in via your web browser and
534-5.7.14 then try again.

The login and password are okay.

The code is:

PROCEDURE SendEmail(sName is string, spar_RecipientEmail is string, spar_Subject is string,...
spar_Body is string, spar_SenderEmail is string, spar_Attachment is string, npar_NbAttach is numeric)

sMessage is string
sEMailOptions is string
nEmailOptions is int

sSenderEmail is string =NoSpace(spar_SenderEmail)
sRecipientEmail is string =NoSpace(spar_RecipientEmail)
sSubject is string =spar_Subject
sBody is string =sName+":="+CR+spar_Body

EmailSetTimeOut(10)
// Use a secured SMTP server with authentication
IF gbEmail_SMPT_SSL THEN
sEMailOptions = "emailOptionDefault"
nEmailOptions = emailOptionDefault
gnEmail_SMTP_Port = 465

ELSE
sEMailOptions = "emailOptionSecuredTLS"
nEmailOptions = emailOptionSecuredTLS
gnEmail_SMTP_Port = 587
END
//For this example i will show the variables:
sName = "Aad Mess"
gsEmail_no_reply = "ahjmess@gmail.com"
gsEmail_SMTP_Server = "smtp.gmail.com"
gnEmail_SMTP_Port = 587
spar_RecipientEmail = "ahjmess@gmail.com"
spar_Subject = "Test"
spar_Body = "Test"
spar_SenderEmail ="ahjmess@gmail.com"
spar_Attachment = ""
npar_NbAttach = 1
//gsEmail_password = ":-)"

//Open the Session
IF NOT EmailStartSMTPSession(gsEmail_no_reply,gsEmail_password,gsEmail_SMTP_Server,gnEmail_SMTP_Port,False,nEmailOptions) THEN
sMessage = "ERROR ( "+ErrorInfo()+" ). In case of a time-out, check the parameters of the firewall on the port used ( "+gnEmail_SMTP_Port+" )."
//Error(sMessage)
GloLogging("ERROR",sMessage)
GOTO RESULT_FALSE
END

// Initializes the components of the email
Email.Sender = sSenderEmail // The sender
//Trace(spar_SenderEmail, spar_RecipientEmail) //for testing
Email.SenderAddress=sSenderEmail
Email.Recipient[1] = sRecipientEmail // The recipient
Email.NbRecipient = 1 // The number of recipients
Email.Subject = sSubject // The subject
Email.Message = HTMLToText(sBody) // The body of the message
Email.HTML = sBody
Email.NbAttach = npar_NbAttach // The number of attachments
Email.Attach = spar_Attachment

IF NOT EmailSendMessage(gsEmail_no_reply) THEN
sMessage = "Cannot open connection ( "+ErrorInfo()+" ). In case of a time-out, check the parameters of the firewall on the port used ( "+gnEmail_SMTP_Port+" )."
//Error(sMessage)
GloLogging("ERROR",sMessage)
GOTO RESULT_FALSE
END

EmailCloseSession(gsEmail_no_reply)
RESULT True

Viewing all articles
Browse latest Browse all 1914

Trending Articles



<script src="https://jsc.adskeeper.com/r/s/rssing.com.1596347.js" async> </script>