Sending Emails With Sheerpower
In today’s fast-paced business world, timely and efficient communication is key.
Imagine automating your daily reports, sending instant alerts for critical system events,
or delivering personalized invoices—all with just a few lines of code.
SheerPower’s email facility makes this possible, providing a robust, flexible, and easy-to-use solution
for integrating email functionality into your applications.
Whether you need to send plain text or beautifully formatted HTML emails, attach important documents,
or manage email authentication seamlessly, SheerPower has you covered. This tutorial will guide you
through the essentials: understanding the syntax, leveraging powerful parameters, and exploring practical examples
to unlock the full potential of automated email communication.
Basic Syntax
email$ = 'mailto://' + sendto$ +
'?subject=' + subject$ +
'&mailfrom=' + mailfrom$ +
'&replyto=' + replyto$ +
'&friendlyname=' + friendlyname$ +
'&cc=' + cc$ +
'&server=' + servername$ +
'&username=' + username$ +
'&password=' + password$ +
'&mime_type=html'
open file email_ch: name email$, access output
print #email_ch: 'Text of email.'
close #email_ch
1. Parameters Explained
Parameter |
Description |
sendto$ |
Email recipient |
subject$ |
Subject line of the email |
mailfrom$ |
The "from" email address |
replyto$ |
The email address for replies |
friendlyname$ |
Display name for the sender |
cc$ |
Email addresses to copy |
servername$ |
SMTP server address |
username$ |
SMTP username (if required) |
password$ |
SMTP password (if required) |
mime_type=html |
Specifies HTML email format |
2. Example
This example demonstrates sending an email with user input:
<
mailform$ = '<form>' +
'From: <input name="from"><br>' +
'Reply To: <input name="reply"><br>' +
'Text: <textarea name="body"></textarea>' +
'<input type="submit">' +
'</form>'
line input dialogbox mailform$: data$
email$ = 'mailto://' + sendto$ + '?subject=' + subject$ +
'&mailfrom=' + mailfrom$ + '&replyto=' + replyto$
open out_ch: name email$, access output
print #out_ch: 'Hello World'
close #out_ch
3. Best Practices
- Use a local or commercial SMTP server to minimize delays.
- Include authentication credentials if required by the SMTP server.
Note: For highest reliability, ensure the SMTP server is
on the same server as SheerPower, on the same LAN, or on a commercially available SMTP
high-availablity service, such as https://www.authsmtp.com/.
Business Application Examples
SheerPower's email facility enables automation for various business tasks. Below are
eight examples demonstrating its use in business applications, including overnight
processes and report generation.
-
Automated Report Distribution
Generate and send daily reports to stakeholders:
email$ = 'mailto://
[email protected]?subject=Daily Sales Report' +
'
[email protected]&mime_type=html'
open file email_ch: name email$, access output
print #email_ch: '<h1>Daily Sales Report</h1>'
print #email_ch: '<p>Total Sales: $50,000</p>'
close #email_ch
-
Invoice Delivery
Send invoices to customers after processing orders:
email$ = 'mailto://
[email protected]?subject=Your Invoice' +
'
[email protected]&attach=invoice123.pdf'
open file email_ch: name email$, access output
print #email_ch: 'Dear Customer,'
print #email_ch: 'Please find your invoice attached.'
close #email_ch
-
Server Monitoring Alerts
Send alerts when server metrics exceed thresholds:
email$ = 'mailto://
[email protected]?subject=Server Alert' +
'
[email protected]'
open file email_ch: name email$, access output
print #email_ch: 'CPU usage has exceeded 90%. Immediate attention required.'
close #email_ch
-
Employee Timesheet Reminders
Send weekly reminders to employees to complete timesheets:
email$ = 'mailto://
[email protected]?subject=Timesheet Reminder' +
'
[email protected]'
open file email_ch: name email$, access output
print #email_ch: 'Please complete your timesheet by Friday, 5 PM.'
close #email_ch
-
Customer Feedback Requests
Request feedback from customers after service completion:
email$ = 'mailto://
[email protected]?subject=We Value Your Feedback' +
'
[email protected]&mime_type=html'
open file email_ch: name email$, access output
print #email_ch: '<h2>Your Feedback is Important</h2>'
print #email_ch: '<p>Please click <a href="https://survey.com">here</a> to ' +
'give your feedback.</p>
close #email_ch
-
System Backup Completion Notifications
Notify administrators of successful backup completions:
email$ = 'mailto://
[email protected]?subject=Backup Completed' +
'
[email protected]&attach=backup_log.txt'
open file email_ch: name email$, access output
print #email_ch: 'The nightly backup completed successfully.'
close #email_ch
-
Sales Order Notifications
Inform the sales team of new orders placed:
email$ = 'mailto://
[email protected]?subject=New Order Received' +
'
[email protected]'
open file email_ch: name email$, access output
print #email_ch: 'Order #12345 has been placed by Customer XYZ.'
print #email_ch: 'Total Amount: $250.00.'
close #email_ch
-
Late Payment Notices
Send automated reminders for overdue invoices:
email$ = 'mailto://
[email protected]?subject=Payment Overdue' +
'
[email protected]'
open file email_ch: name email$, access output
print #email_ch: 'Dear Customer,'
print #email_ch: 'Our records show that invoice #98765 is overdue.'
print #email_ch: 'Please make payment at your earliest convenience.'
close #email_ch
Summary: Email Facility
SheerPower's email facility provides a powerful yet straightforward solution
for automating email-based tasks in business applications. By constructing
email URLs with the mailto://
scheme and leveraging SMTP
servers, developers can send plain text or HTML emails, attach files, and
include advanced configurations such as authentication and CC/BCC recipients.
This tutorial highlighted several practical applications:
- Automated Report Distribution: Send daily or periodic reports.
- Invoice Delivery: Email invoices with attachments.
- Server Monitoring Alerts: Notify administrators of critical events.
- Employee Reminders: Automate timesheet and task notifications.
- Customer Feedback Requests: Collect feedback via email surveys.
- Backup Notifications: Alert on backup completion or failure.
- Sales Order Updates: Inform teams of new orders.
- Late Payment Notices: Remind customers about overdue invoices.
By using optional parameters like mime_type
,
username
, and password
, emails can be customized to
meet various business needs securely. Best practices, such as utilizing a
local SMTP server for critical messages, enhance
reliability and efficiency.
With its simplicity and flexibility, SheerPower's email facility is an
essential tool for automating communication in modern business environments.