PC SOFT

FOROS PROFESIONALES
WINDEVWEBDEV y WINDEV Mobile

Inicio → WINDEV 2024 → Email.NbAttach + Email.Attach specified but no appearance in email ?
Email.NbAttach + Email.Attach specified but no appearance in email ?
Iniciado por software, 24,ago. 2016 17:26 - 1 respuesta
Miembro registrado
27 mensajes
Publicado el 24,agosto 2016 - 17:26
Hi,

I use the EmailSendMessage instruction for quite a time with no problem.
I use also Email.NbAttach + Email.Attach for my Attach file(s).

When i debug the project within Windev20 my application is working fine , its created correct emails with attach files !

After creating the executable the application is creating the emails but without attachment files ?????
I had no errors .

What could be wrong ?

Hope someone can help me quick cause i have a production isuue to sove.

Thanks,

Eric
Procedure Email_Klant_Copy_Werkbon(p_datum_planning, p_technieker, p_bestand, p_taal_klant, l_error)
// Versturen van copy werkbon naar de klant
// ========================================
sHTMLFile is string //name of the file and access path of the HTML file
sDir is string //name of dir of HTML file
SWITCH p_taal_klant
CASE "NL"
sHTMLFile = g_path_WB_DOC + "werkbon_email_klant.htm"
CASE "FR"
sHTMLFile = g_path_WB_DOC + "werkbon_email_klant_FR.htm"
OTHER CASE
sHTMLFile = g_path_WB_DOC + "werkbon_email_klant.htm"
END

//Start a SMTP session
EmailSetTimeOut(g_EmailSetTimeOut) // Time_out
IF EmailStartSMTPSession( g_Email_Sender, g_PasswordUserSMTP , g_SessionSMTP, g_PortSMTP, False ,emailOptionSecuredTLS) = True THEN
// initialization
EmailReset()
// retrieves the directory of the HTML file
sDir = fExtractPath(sHTMLFile,fDirectory)
// fill the email structure
EmailImportHTML(fLoadText(sHTMLFile),sDir)
// Customization
// replace the HTML variables
// Email.HTML = Replace(Email.HTML,"[%Technieker%]",p_technieker)
// Email.HTML = Replace(Email.HTML,"[%Datum%]",DateToString(p_datum_planning))
SWITCH p_taal_klant
CASE "NL"
Email.HTML = Replace(Email.HTML,"[%Technieker%]",p_technieker)
Email.HTML = Replace(Email.HTML,"[%Datum%]",DateToString(p_datum_planning))
CASE "FR"
Email.HTML = Replace(Email.HTML,"[%Technicien%]",p_technieker)
Email.HTML = Replace(Email.HTML,"[%Date%]",DateToString(p_datum_planning))
OTHER CASE
Email.HTML = Replace(Email.HTML,"[%Technieker%]",p_technieker)
Email.HTML = Replace(Email.HTML,"[%Datum%]",DateToString(p_datum_planning))
END
//Sender of the message
Email.Sender = g_Email_Sender
//Recipients of the message
Email.Recipient[1] = g_Email_Recip_Klant
Email.NbRecipient = 1

Email.Bcc[1] = g_Email_Sender
Email.NbBcc = 1

IF g_Email_Recip_Forward <> "" THEN
Email.Bcc[2] = g_Email_Recip_Forward
Email.NbBcc = 2
END
//Attachments
Email.NbAttach = 1
Email.Attach = g_Path_server + p_bestand
//Subject and content of message
//Email.Subject = g_Omgeving+"/(Klant) Copy " + Middle(p_bestand,Position(p_bestand ,"\",1)+1)
SWITCH p_taal_klant
CASE "NL"
Email.Subject = g_Omgeving+"/(Klant) Kopie " + Middle(p_bestand,Position(p_bestand ,"\",1)+1)
CASE "FR"
Email.Subject = g_Omgeving+"/(Client) Copie " + Middle(p_bestand,Position(p_bestand ,"\",1)+1)
OTHER CASE
Email.Subject = g_Omgeving+"/(Klant) Kopie " + Middle(p_bestand,Position(p_bestand ,"\",1)+1)
END

IF EmailSendMessage(g_Email_Sender) = False THEN
Error()
l_error = 1
ELSE
// recupereren email_bestand
// =========================
IF EmailBuildSource() = True THEN
// opzoeken folder emails in klant folder
savefolder is string = ""
savefoldertext is string
HReadSeekFirst(TYPEDOC,Type_doc,"COMMXX")
IF HFound(TYPEDOC) = True THEN
IF TYPEDOC.Map_doc <> "" THEN
savefolder = g_Path_PDF + TYPEDOC.Map_doc + "\"
ELSE
savefolder = g_Path_PDF
END
// check of map dient aangemaakt te worden ?
// =========================================
FileID is int = fMakeDir(savefolder)
IF FileID = -1 THEN
Error(ErrorInfo())
l_error = 1
// schrijf in LOG bestand ?

//
GOTO END_BUTTON
END
savefoldertext = savefolder + Replace(ExtractString(p_bestand,1,"\",FromEnd),".PDF",".eml")
fSaveText(savefoldertext,Email.Source)
ELSE
savefolder = g_Path_PDF
// check of map dient aangemaakt te worden ?
// =========================================
FileID is int = fMakeDir(savefolder)
IF FileID = -1 THEN
Error(ErrorInfo())
l_error = 1
// schrijf in LOG bestand ?

//
GOTO END_BUTTON
END
savefoldertext = savefolder + Replace(ExtractString(p_bestand,1,"\",FromEnd),".PDF",".eml")
fSaveText(savefoldertext,Email.Source)
END
ELSE
l_error = 1
END
END
END_BUTTON:
EmailCloseSession(g_Email_Sender)

ELSE
Error("Unable to establish connection", ErrorInfo(), ...
"In case of time-out, check the parameters of the "+ ...
"""Firewall"" on the port used (587)")
l_error = 1
END
Miembro registrado
27 mensajes
Publicado el 25,agosto 2016 - 08:44
Corrections on the above code : (code was bad copied), sorry

SWITCH p_taal_klant
CASE "NL"
Email.HTML = Replace(Email.HTML,"[%Technieker%]",p_technieker)
Email.HTML = Replace(Email.HTML,"[%Datum%]",DateToString(p_datum_planning))
CASE "FR"
Email.HTML = Replace(Email.HTML,"[%Technicien%]",p_technieker)
Email.HTML = Replace(Email.HTML,"[%Date%]",DateToString(p_datum_planning))
OTHER CASE
Email.HTML = Replace(Email.HTML,"[%Technieker%]",p_technieker)
Email.HTML = Replace(Email.HTML,"[%Datum%]",DateToString(p_datum_planning))
END

It seems to be that the code is not good displayed here !!
Mensaje modificado, 25,agosto 2016 - 08:46