| Home | Getting Started | Browse by Category | All functions |
Using an external file for the message body is often easier than embedding the whole body directly in Clarion source.
It is a good fit when:
The Body parameter on vuSendMail() and vuSendMailWait() can be ordinary body text or a path to an existing file.
If the Body value points to an existing file, vuMailKit loads that file and uses the file contents as the message body.
Dear Customer,
Your order is ready.
Thank you for your business.
Result LONG
FromAdr CSTRING(256)
ToAdr CSTRING(256)
CCAdr CSTRING(256)
BCCAdr CSTRING(256)
Subject CSTRING(256)
Body CSTRING(260)
Attach CSTRING(260)
FromAdr = ''
ToAdr = 'customer@example.com'
CCAdr = ''
BCCAdr = ''
Subject = 'Your order is ready'
Body = CLIP(PATH()) & '\CustomerNotice.txt'
Attach = ''
Result = vuSendMailWait(FromAdr, ToAdr, CCAdr, BCCAdr, Subject, Body, Attach)
IF Result <> 1
MESSAGE('Send failed: ' & vuMailLastError())
END
<!doctype html>
<html>
<head>
<meta charset="utf-8">
</head>
<body>
<h2>Your order is ready</h2>
<p>Dear Customer,</p>
<p>Your order is ready for pickup.</p>
</body>
</html>
Body = CLIP(PATH()) & '\CustomerNotice.html'
Attach = ''
Result = vuSendMailWait(FromAdr, ToAdr, CCAdr, BCCAdr, Subject, Body, Attach)
IF Result <> 1
MESSAGE('Send failed: ' & vuMailLastError())
END
When the loaded body is HTML, vuMailKit uses the normal HTML send path and creates a plain-text alternative body.
Local image references in HTML img src values can be resolved from the folder containing the HTML file. Keep the image next to the HTML file or use a full path.
<p><img src="CompanyHeader.png" alt="Company"></p>
<p>Your order is ready.</p>
Save external text and HTML files as UTF-8 when they contain accented letters or other international characters. HTML files should also include a charset declaration such as <meta charset=”utf-8”>.
| Home | Getting Started | Browse by Category | All functions |