|
| Inicio → WINDEV 2024 → Direct sending emails with integrated text and not a attachment. |
| Direct sending emails with integrated text and not a attachment. |
| Iniciado por guest, 01,jun. 2018 13:47 - 7 respuestas |
| |
| | | |
|
| |
| Publicado el 01,junio 2018 - 13:47 |
Hi all,
Im figuring, what's the best way to directly send emails with integrated text and not with a pdf-attachment, so without using iPreview. Has anyone achieved this and is willing to share some of it ?
I know there's an option in the Preview screen, but that doens't work with every browser. Most of the time the text is included as a *.html attachment.
Best regards,
Aad |
| |
| |
| | | |
|
| | |
| |
| Publicado el 01,junio 2018 - 14:43 |
Hi,
I'm not sure I understand the question...
To send emails, you have the while family of emailxxxx functions, and none of that has anything to do with printing.
Best regards |
| |
| |
| | | |
|
| | |
| |
| Publicado el 01,junio 2018 - 15:05 |
Ok, I will be more precize.
I have a bunch of reports, that I want to send by email directly as text in the mail, so not as an attachment. I know you can print the report as iHTML and use fLoadHTML (or something like that) in conjunction with the email functions.
I was wondering if there was an easier way. |
| |
| |
| | | |
|
| | |
| |
| Publicado el 01,junio 2018 - 16:27 |
Aad
As Fabrice indicated you will need to look to the email variables and functions
here is a quick stab at some code to get you thinking
emlRpt is a Email sEmailaddress is string sSubject is string sBody is string sRecipientAddress is string
emlRpt.Sender = ""Friendly Name"" <"+sEmailaddress+">" emlRpt.SenderAddress = ""Friendly Name"" <"+sEmailaddress+">" emlRpt.Subject = sSubject emlRpt.Message = sBody Add(emlRpt.Recipient,sRecipientAddress)
sEmailSessionUser is string // you should need user authentication information cause no smtp server should be an open relay sEmailSessionPW is string
mEmlSess is a EmailSMTPSession mEmlSess.ServerAddress = "mx1.example.com" // can be either FQDN or IP Address mEmlSess.Name = gsEmailSessionUser mEmlSess.Password = gsEmailSessionPW mEmlSess.Port = 587 // Port will be influenced by what your smtp server accepts but should be 587 for submission but can be 465 for SSL mEmlSess.Option = emailOptionSecuredTLS // again influence by smtp server but you should always encrypt your transmission
// Start a SMTP session EmailSetTimeOut(20) HourGlass(True) IF EmailStartSession(mEmlSess) THEN // Send the message IF NOT EmailSendMessage(mEmlSess,emlRpt) THEN NextTitle("Transmit - Failure") Error("A Connection to the Server was established, although a"+CR, "subsequent error prevented sending the report."+CR+CR+"You may try sending the report again, or contact support."+CR+CR+ErrorInfo(errMessage)+CR+CR) END ELSE NextTitle("Transmit - Failure") Error(CR+"Unable to Connect to the Server"+CR+CR+"Please confirm local Internet connectivity and"+CR+"try sending the report again, or contact support."+CR+CR+ErrorInfo(errMessage)+CR+CR) END HourGlass(False) EmailCloseSession(mEmlSess)
You should probably have a progress bar too |
| |
| |
| | | |
|
| | |
| |
| Publicado el 01,junio 2018 - 16:37 |
I should add that if you are contemplating sending complex HTML reports via the email body you should really think twice.
The reason is that you have absolutely no control over client email readers and every email reader will interpret html differently enough that it's a lot of work especially if you want to have your html survive as intended after being forwarded.
So again consistent html rendering in email clients is very tough just do some research and save yourself a lot of headaches. |
| |
| |
| | | |
|
| | |
| |
| Publicado el 02,junio 2018 - 19:43 |
Hi Eric,
Thanks very much for your contribution.
Best regards,
Aad |
| |
| |
| | | |
|
| | |
| |
| Publicado el 02,junio 2018 - 22:19 |
Hi AAd,
you can use idestination(iHTMLwithoutCSS) to print your reports in a html format, that can be used in Outlook E-Mail body.
But:
WD18 is the last version where this works. PCSoft has broken this functionality in WD19 and till now they didn´t fix this. |
| |
| |
| | | |
|
| | |
| |
| Publicado el 02,junio 2018 - 23:40 |
Hello Michael,
I did not know that. I made some testfiles (simple files) and even then you get unpredictable results, just like Eric says. RTFToHTML gave the best result. There is a nice WD email example and the result looks good, so it IS possible to make emails that give a good result in different emailclients. It's a quite complex example program though.
Thanks for your reaction.
Best regards,
Aad |
| |
| |
| | | |
|
| | | | |
| | |
|