Emails with conzept 16 (Part 2)

In article E-Mails mit CONZEPT 16, I explained how you can create, format and send emails. However, I have not gone into some of the functions, such as including files in the HTML text or adding attachments with a special MIME type. These and other topics are covered in the following article.


Info:

The automatic e-mail notification also uses the mail commands internally.

This article covers the following topics:


Encoding

Each file in an e-mail, both the message content and the attachment, is encoded in a specific way. There are three coding options available:

  • base64 (_MimeTE_B64)
    A readable character string is generated from any byte sequence using a “3 to 4″conversion. This is the standard encoding method for attachments.
  • quoted-printable (_MimeTE_QP)
    Control characters, ASCII characters above 127 and some special characters are replaced by a hexadecimal representation. This is the standard encoding method for texts.
  • 8-Bit (_MimeTE_8B)
    No encoding takes place. This option can only be used for texts without control characters.

The “TE” in the constants stands for Transfer Encoding.

// Do not encode plain text
tMail->MailData(_MailFile | _MimeTE_8B, _Sys->spPathDesktop + 'welcome.txt');

// Quoted-printable encoding of Word file
tMail->MailData(_MailFile | _MimeAppMSWORD | _MimeTE_QP, _Sys->spPathMyDocuments + 'welcome.dox');

Character set

A character set can also be specified for the message content. The ISO-8859-1 character set is used by default. However, this only contains some of the Western European special characters. For example, the euro symbol is missing. Alternatively, one of the following character sets can be used.

  • _MimeCS_IBM437 (Codepage 437)
  • _MimeCS_IBM850 (Codepage 850)
  • _MimeCS_UTF8 (Unicode)

Das “CS” in den Konstanten steht für Charset.

// HTML text in UTF-8 character set
tMail->MailData(_MailFile | _MimeTextHTML | _MimeCS_UTF8, _Sys->spPathDesktop + 'welcome.html');

Embedding attachments in the HTML text

When sending an HTML mail, attachments can be embedded in the message. To do this, the constant _MimeRelated must be used when attaching the file. Furthermore, the HTML reference must be specified in the fifth argument. The HTML reference is the name of the file, which is specified in the src attribute of an img element, for example.

It is possible to specify both a complete URI and a symbolic name. This allows a complete HTML page to be sent by e-mail without any changes.

HTML-text:

<html>
<body>
<img src="http://www.myaddress.com/images/mailheader.png"/>
...
<img src="mailfooter.png"/>
</body>
</html>

To embed the images in the HTML mail, they must be attached as follows:

// mailheader.png einbetten
tMail->MailData(_MailFile | _MimeImagePNG, _Sys->spPathMyPictures + 'header.png',
                '', 'http://www.myaddress.com/images/mailheader.png');

// embed mailfooter.png
tMail->MailData(_MailFile | _MimeImagePNG, _Sys->spPathMyPictures + 'footer.png',
                '', 'mailfooter.png');

Using special MIME types

The MIME type must be specified for attachments. If a MIME type is to be used that is not defined via a conzept 16 constant,
one of the following constants can be used:

  • _MimeOtherB64 – The file is base64 encoded.
  • _MimeOtherQP – The file is encoded as printed quotable.
  • _MimeOther8B – The file is not encoded.

The MIME type is passed as an alpha value in the fourth argument.

An overview of all known MIME types can be found under SELFHTML.

// Audio file as an attachment
tMail->MailData(_MailFile | _MimeOtherB64, _Sys->spPathMyMusic + 'mario.wav','audio/x-wav');

// RTF text as an attachment
tMail->MailData(_MailFile | _MimeOtherQP, _Sys->spPathMyDocuments + 'info.rtf','text/rtf');

If no MIME type is defined for a file, e.g. database definition (.d01), a general MIME type can be defined with the constant _MimeApp.

// Add database definition
tMail->MailData(_MailFile | _MimeApp, _Sys->spPathDesktop + 'update.d01');

Klicken Sie hier, um die Nutzungsbedingungen für unseren Blog zu lesen.

Leave a Reply

Your email address will not be published. Required fields are marked *

Leave the field below empty!

Requests, questions or feedback are welcome:

Terms of use of the comment function in the blog

1. General information

Vectorsoft AG (‘Provider’) provides a public blog for Internet users (‘Users’) on the vectorsoft.de website. The public blog is intended for the exchange of information and ideas. Users who participate with contributions and comments undertake to comply with the blog terms of use and are responsible for the accuracy, appropriateness and freedom from legal infringements of their contributions. By using the comment function in our blog, you accept these terms of use.

2. Netiquette

We ask you to refrain from personal attacks and provocations based on other opinions. Please argue objectively and maintain a constructive discussion culture. Your comment should always be related to the topic in question in order to avoid digressions into other topics. Posting the same comment or several similar comments more than once is not permitted.

3. Prohibition of illegal content

By submitting your comment, you confirm that you are not violating any copyrights or other rights of third parties. Inciting, racist statements, instructions for criminal offences and their glorification, depictions of violence, pornographic content and statements that violate personal rights are prohibited.

4. No advertising

The use of the comment function is not permitted for commercial or party-political purposes. Advertising contributions of any kind will be deleted immediately.

5. Details of the name

When entering your name, pay attention to the principles mentioned above.

6. Source references

If you intend to publish quotes or contributions from third parties, please indicate the respective sources and explain how they relate to the blog post.

7. Violation of the terms of use

Posts that violate this policy will be deleted immediately. If you notice any violations yourself, please send us the link to the comment in question by e-mail to . We expressly point out that we will exclude individual users in the event of repeated or serious violations of these terms of use.

As of: Sept. 2024

Get your Trial Version now!

Test yeet free of charge

IHRE EVALUIERUNGSLIZENZ - JETZT ANFORDERN!

TESTEN SIE DIE CONZEPT 16 VOLLVERSION - UNVERBINDLICH und KOSTENFREI

Subscribe to our newsletter

[cleverreach_signup]
WordPress Cookie Notice by Real Cookie Banner