Login    Sites MenuBlueStep

BlueStep Platform Support

RelateScript
Outline full outline 
Overview 
Data Types 
Operators 
Statements 
Functions 
Data Conversion 
String Functions 
HTML/CSS/JavaScript 
Array Functions 
Date/Time Functions 
Mathematical Functions 
Advanced Functions 
Alert Functions 
compileSASS(String Sass) 
createChart(...) 
doLookup(...)
B.lookup
 
drugAllergyByProductID(...)
B.Drug.allergyInteractionsWith
 
drugDrugByProductID(...)
B.Drug.drugInteractionsWith
 
drugFoodByProductID(...)
B.Drug.foodInteractions
 
getCurrentNav(...) 
getHTTPRequester(...)
B.fetch
 
getPageInfo()
B.pageInfo
 
getPDF(...)
B.pdf
 
getRecentRecords(...)
B.optRecentRecords,BaseRecord.optRecentRecords,User.recentRecords
 
getSecurityGroup(...)
B.findSecurityGroup
 
getUserData(...)
B.sessionData,User.userData
 
getZipOutput(...)
B.zip
 
isLayout() 
log(...) 
Medispan 
newEmail(...)
B.email
 
readZip(...)
B.zip
 
sendEmail(...)
B.email
 
sendIntramail(...) 
sendMessage(...)
B.sendMessage
 
sendRedirect(...)
B.response.sendRedirect
 
sleep(...) 
Restricted Functions 
Working with Relate Data 
How Formulas Work 
Related Topics 

The newEmail(...) function is used to send email.  It differs from the sendEmail(...) function in its complexity and power. The newEmail(...) function creates an email message object which can be manipulated to send almost any type of email and use many of the advanced email features such as attachments and embedded images. In contrast the sendEmail(...) function is more simple in most ways:  It offers a quicker but less flexible way of sending email. The newEmail( ) function is very simple to begin. It only has one possible syntax. The result of the function is an EmailMessage object with many properties and functions that are described in the section below.

Syntax:
newEmail( )

EmailMessage Object

Field/Function Description
to(emails)
to(email, name) 
The to(...) function receives either a list of one or more email addresses (comma delimited), or a single email address and a person's name.  In either case the email address(es) will be added to the TO list of recipients of the email.  The to(...) function may be called repeatedly to add additional recipients.  The result of the to(...) function is the original EmailMessage object.
cc(emails)
cc(email, name) 
The cc(...) function receives either a list of one or more email addresses (comma delimited), or a single email address and a person's name.  In either case the email address(es) will be added to the CC list of recipients of the email.  The cc(...) function may be called repeatedly to add additional recipients.  The result of the cc(...) function is the original EmailMessage object.
bcc(emails)
bcc(email, name) 
The bcc(...) function receives either a list of one or more email addresses (comma delimited), or a single email address and a person's name.  In either case the email address(es) will be added to the BCC list of recipients of the email.  The bcc(...) function may be called repeatedly to add additional recipients.  The result of the bcc(...) function is the original EmailMessage object.
from(emails)
from(email, name) 
The from(...) function receives either a list of one or more email addresses (comma delimited), or a single email address and a person's name.  In either case the email address(es) will be added to the FROM list of persons who are responsible for the content of the email message or who desired the email to be sent.  The from(...) function may be called repeatedly to add additional parties.  The result of the from(...) function is the original EmailMessage object.
replyTo(emails)
replyTo(email, name) 
The replyTo(...) function receives either a list of one or more email addresses (comma delimited), or a single email address and a person's name.  In either case the email address(es) will be added to the REPLY-TO list of persons to whom the sender requests that any reply be sent.  The replyTo(...) function may be called repeatedly to add additional parties.  The result of the replyTo(...) function is the original EmailMessage object.
sender(email, name)  The sender(...) function receives a single email addresses, or optionally a single email address and a person's name.  In either case the email address will be used as the sender field of the email.  The sender is the single email account which is responsible for actually sending the message.  IMPORTANT: The sender address MUST be hosted by mail.bluestep.net or the the email will almost certainly be marked as spam.  It is recommended that this field be left at its default value in most cases.  The sender(...) function may be called repeatedly, but each call will eliminate the prior value received.  The result of the sender(...) function is the original EmailMessage object.
subject(text) The subject(...) function receives the subject line of the email.  The subject is one of the mandatory values which must be set for the email to be successfully sent  The result of the subejct(...) function is the original EmailMessage object.
text(body) The text(...) function receives the plain text body of the email message.  The plain text message body is seen by the recipient if there is no HTML body or if the receiving email software does not support display of HTML.  The result of the text(...) function is the original EmailMessage object.
html(body) The html(...) function receives the HTML body of the email message.  The html body should be a full HTML document complete with at least an enclosing html tag and a body section.  Please note that although HTML is usually the preferred format for email, not all email reader software supports HTML.  If a receiver's email software does not support HTML then either the plain text email message will be displayed (if present) or the source-code of the HTML message will be shown.  The result of the html(...) function is the original EmailMessage object.
attach(file) The attach(...) function receives a list of one or more files to attach (comma delimited).  Each file must be either the id of a document uploaded to the BlueStep platform or the permUrl of an uploaded document (beginning with "/download/"). If the document is referenced by its permUrl from within the HTML body of email message then the attachment will be converted to an embedded attachment and the URL in the HTML body will be converted to a "cid:" url referencing the embedded file.  This is generally used exclusively for small images displayed within the email message.  Many email clients do not show embedded attachments in the normal attachment list.  The attach(...) function may be called repeatedly to add additional attachements.  The result of the attach(...) function is the original EmailMessage object.
embedAll() The embedAll() function receives no additional data.  If used it causes the HTML body of the email message to be searched for permUrls of documents uploaded to the BlueStep system.  Each url found will be converted to an embedded attachment without the need to use the attach(...) function.  This function is NOT smart enough to recognize URLs found within the HTML body that should not be converted such as URLs included as text instead of a tag attribute or fully qualified URLs with a domain and protocol.  Use this function with some caution when sending complex HTML email.  The result of the embedAll(...) function is the original EmailMessage object.
priority(number) The priority function sets the STMP priority field to high, normal or low.  If the number received is null or 0 the priority will be normal.  If the number is greater than 0 the priority will be high.  Otherwise the priority will be low.  The result of the priority(...) function is the original EmailMessage object.
bulkPriority(number) The bulk priority is a BlueStep feature which allows large bulk mailings to be sent with a lower computing priority so other smaller mailing to not get unduely delayed.  If sending a large quantity of emails please be polite and take advantage of this feature.  The number given should be from 0 to 9 with 0 being highest priority and the default.  The result of the bulkPriority(...) function is the original EmailMessage object.

WARNING: BlueStep client agreements prohibit sending unsolicited or spam email.  Bulk emails should only be sent to people with whom your organization has an existing relationship.  Failure to follow this rule may result in termination of your account.  This especially important because if our mail server becomes marked as a spam server then our ability to send email on behalf of ALL of our clients becomes seriously compromised.
send() The send() function queues the email message to be sent.  The send() function may only be called once for a given EmailMessage object.  The result of the send() function is a boolean value indicating whether the email was successfully queued.  Once put in the email queue the message is generally sent within 5 minutes.  For email to be successfully sent there are a few values that must be used/set:  There must be at least one TO, CC or BCC recipient.  There must be at least one FROM.  There must be a subject.  There must be either a plain text or HTML message body (or both).  The email addresses in the to, cc, bcc, from, reply-to and sender fields must be syntatically valid.  If the send() function results in false, the reason for the failure may be determined using the errors field described next.
errors The errors field is a read-only String value containing a newline delimited list of error messages caused by calling any of the functions described above.
resetErrors() The resetErrors() function causes the errors field to be cleared.  Sometimes it may be difficult to determine which action is causing an error.  Executing the resetErrors() function, performing a single action (calling a single function), then checking the errors field for a value is one way to isolate and diagnose these types of problems.

B.email()