Hi folks,
I am working on a software where it is necessary to send small plain text emails within the company network. The content of these emails must necessarily appear in table-like form in the email. This has been explained several times in other places here in the forum, the case here is a little more special.
As far as I know, you can send emails in B4J (it is a B4J application) in two ways:
1. you send the email via SMTP and then you can design the content of the email quite freely (HTML etc.)
2. you generate the email via JFX and send the email content to the email programme on your PC
Of course, I would prefer the first option, but unfortunately direct access to the SMTP server in the company network is blocked for security reasons. Sending via SMTP therefore does not work. Using an external email address (another SMTP server) works, but occasionally emails end up in the recipient's spam folder and this approach is generally not appreciated by the company's IT department. These are primarily security-related hurdles that unfortunately preclude sending via SMTP.
When using the second variant, there are no security problems, but formatting the email content is very difficult.
The client uses Outlook and via the well-known JFX function I can also transfer the desired text to Outlook and open the email window. The problem with this variant is the flexible length of the characters of a font in Outlook itself. These then naturally lead to lateral shifts within the text of the email.
Unfortunately, tab functions do not work with this variant either. Tabs are generated, but consist of 2 or 4 spaces, depending on the definition in Outlook, which unfortunately does not change the problem of the shifts.
The first solution would be to somehow get Outlook to generate the email with a monospace font, which would then immediately eliminate the shifts in the table. But how?
A second solution could be measuring the text length of the texts in the individual columns and to artificially lengthen the corresponding string in order to generate an alignment in the form of a table again. Or even better: The string passed for the email body itself takes care of the corresponding setting in Outlook, perhaps even for the display in HTML form. Unfortunately, my attempts to pass even a simple HTML string to Outlook in this way failed. Perhaps there is a solution for this?
Or is the use of Textmetric possibly a solution?
Any comments are really welcome...
I am working on a software where it is necessary to send small plain text emails within the company network. The content of these emails must necessarily appear in table-like form in the email. This has been explained several times in other places here in the forum, the case here is a little more special.
As far as I know, you can send emails in B4J (it is a B4J application) in two ways:
1. you send the email via SMTP and then you can design the content of the email quite freely (HTML etc.)
2. you generate the email via JFX and send the email content to the email programme on your PC
Of course, I would prefer the first option, but unfortunately direct access to the SMTP server in the company network is blocked for security reasons. Sending via SMTP therefore does not work. Using an external email address (another SMTP server) works, but occasionally emails end up in the recipient's spam folder and this approach is generally not appreciated by the company's IT department. These are primarily security-related hurdles that unfortunately preclude sending via SMTP.
When using the second variant, there are no security problems, but formatting the email content is very difficult.
The client uses Outlook and via the well-known JFX function I can also transfer the desired text to Outlook and open the email window. The problem with this variant is the flexible length of the characters of a font in Outlook itself. These then naturally lead to lateral shifts within the text of the email.
Unfortunately, tab functions do not work with this variant either. Tabs are generated, but consist of 2 or 4 spaces, depending on the definition in Outlook, which unfortunately does not change the problem of the shifts.
The first solution would be to somehow get Outlook to generate the email with a monospace font, which would then immediately eliminate the shifts in the table. But how?
A second solution could be measuring the text length of the texts in the individual columns and to artificially lengthen the corresponding string in order to generate an alignment in the form of a table again. Or even better: The string passed for the email body itself takes care of the corresponding setting in Outlook, perhaps even for the display in HTML form. Unfortunately, my attempts to pass even a simple HTML string to Outlook in this way failed. Perhaps there is a solution for this?
Or is the use of Textmetric possibly a solution?
Any comments are really welcome...