lucee.Componentmodels.Mail
Copyright Since 2005 ColdBox Framework by Luis Majano and Ortus Solutions, Corp www.ortussolutions.com ---- A mail payload object used by the developer to send mail via the mail services. You can use our dynamic getters and setters to set any property in the configuration structure that can be used by the sending transit protocol. Example: If we use the CFMail protocol then we can set ANY of the attributes that the cfmail tag uses into this configuration object. Then the transit object will use it accordingly.
Property Summary | ||||
---|---|---|---|---|
type | property | default | serializable | required |
struct
|
config
The config struct representing the mail payload which is sent to the configured protocol in the mail service.
|
true
|
false
|
|
string
|
mailer
The mailer to use when sending the payload.
|
true
|
false
|
|
struct
|
results
The structure of results of sending the mail via the protocol.
|
true
|
false
|
|
any
|
wirebox
|
true
|
false
|
Constructor Summary | |
---|---|
init()
Constructor. |
Method Summary | |
---|---|
Mail
|
addAttachments(any files, [boolean remove='false'])
Add attachment(s) to this payload using a list or array of file locations. |
Mail
|
addMailParam([any contentID], [any disposition], [any file], [any type], [any name], [any value], [boolean remove], [any content])
Add mail params to this payload. |
Mail
|
addMailPart([any charset='utf-8'], [any type], [numeric wraptext], [any body])
Add a new mail part to this mail payload. |
Mail
|
config()
Place holder for `configure()` as a compatibility shim. |
Mail
|
configure([any from], [any to], [any body], [any bcc], [any cc], [any charset], [boolean debug], [any failto], [any group], [boolean groupcasesensitive], [any mailerid], [numeric maxrows], [any mimeattach], [any password], [numeric port], [any priority], [any query], [any replyto], [any server], [boolean spoolenable], [numeric startrow], [any subject], [numeric timeout], [any type], [any username], [boolean useSSL], [boolean useTLS], [numeric wraptext], [struct additionalInfo='[runtime expression]'], [any fromName])
Seed the configuration of this object. |
any
|
getAdditionalInfoItem(any key, [any defaultValue=''])
Get the additional info stored by key. |
string
|
getConfig()
|
string
|
getMailer()
|
struct
|
getMemento()
Return the configuration structure. |
any
|
getProperty(any property, [any defaultValue])
Get a config property, throws an exception if not found. |
array
|
getResultMessages()
Get the result messages. |
string
|
getResults()
|
string
|
getWirebox()
|
boolean
|
hasErrors()
Check if the sending had errors or not. |
any
|
onError(any callback)
Callback that if there is an error in the sending of the mail it will be called for you. |
any
|
onMissingMethod([any missingMethodName], [any missingMethodArguments='[runtime expression]'])
Listen to dynamic getters and setters for any configuration setting:. |
any
|
onSuccess(any callback)
Callback that if there is NO error in the sending of the mail it will be called for you. |
boolean
|
propertyExists(any property)
Verifies if a config property exists or not. |
string
|
queue()
Queue the mail payload into our asynchronous work queue. |
Mail
|
send()
Send this mail payload and return itself. |
any
|
sendAsync()
Send this mail payload asynchronously and return a Future. |
Mail
|
setAdditionalInfoItem(any key, any value)
Store additional info items. |
any
|
setConfig(struct config)
|
Mail
|
setHtml(any body)
Sets up a mail part that is HTML using utf8 for you by calling addMailpart(). |
any
|
setMailer(string mailer)
|
Mail
|
setProperty(any property, any value)
Set a config property with a value. |
Mail
|
setReadReceipt(any email)
Set the email address that will receive read receipts. |
any
|
setResults(struct results)
|
Mail
|
setSendReceipt(any email)
Sets the email that get's notified once the email is delivered by setting the appropriate mail headers. |
Mail
|
setText(any body)
Sets up a mail part that is TEXT using utf8 for you by calling addMailpart(). |
Mail
|
setView(any view, [struct args='[runtime expression]'], [any module=''], [any layout], [any layoutModule=''])
Render or a view layout combination as the body for this email. |
any
|
setWirebox(any wirebox)
|
boolean
|
validate()
Validate that the basic fields of from, to, and body are set for sending mail. |
Methods inherited from class lucee.Component |
---|
None |
Constructor Detail |
---|
Constructor
Property Detail |
---|
The config struct representing the mail payload which is sent to the configured protocol in the mail service
access
- publicrequired
- falsereturntype
- anyserializable
- trueThe mailer to use when sending the payload. It defaults to `default`
access
- publicrequired
- falsereturntype
- anyserializable
- trueThe structure of results of sending the mail via the protocol. At most it will contain the following keys: - error : boolean - messages : array of messages
access
- publicrequired
- falsereturntype
- anyserializable
- trueaccess
- publicrequired
- falsereturntype
- anyinject
- wireboxserializable
- trueMethod Detail |
---|
Add attachment(s) to this payload using a list or array of file locations
files
- A list or array of files to attach to this payloadremove
- If true, ColdFusion removes attachment files (if any) after the mail is successfully delivered.Add mail params to this payload
contentID
disposition
file
type
name
value
remove
content
Add a new mail part to this mail payload
charset
type
wraptext
body
Place holder for `configure()` as a compatibility shim
Seed the configuration of this object
from
to
body
bcc
cc
charset
debug
failto
group
groupcasesensitive
mailerid
maxrows
mimeattach
password
port
priority
query
replyto
server
spoolenable
startrow
subject
timeout
type
username
useSSL
useTLS
wraptext
additionalInfo
fromName
Get the additional info stored by key
key
- The key to getdefaultValue
- The default value if not found, defaults to empty stringReturn the configuration structure
Get a config property, throws an exception if not found.
property
- The property to getdefaultValue
- The default value to retrieve if property doesn't existGet the result messages
Check if the sending had errors or not
Callback that if there is an error in the sending of the mail it will be called for you. The callback will receive the results struct and the mail object itself
callback
Listen to dynamic getters and setters for any configuration setting:
getFrom() getFrom( "defaultValue" ) setFrom( "luis@ortussolutions.com" ) setFrom() => empty value, same as setFrom( "" )
missingMethodName
missingMethodArguments
Callback that if there is NO error in the sending of the mail it will be called for you. The callback will receive the results struct and the mail object itself
callback
Verifies if a config property exists or not
property
- The property keyQueue the mail payload into our asynchronous work queue
Send this mail payload and return itself
Send this mail payload asynchronously and return a Future
Store additional info items
key
- The key to storevalue
- The value to storeconfig
Sets up a mail part that is HTML using utf8 for you by calling addMailpart()
body
- The body content to set the mail part onmailer
Set a config property with a value
property
- The property keyvalue
- The property valueSet the email address that will receive read receipts. I just place the appropriate mail headers
email
- The email to send the read recipt toresults
Sets the email that get's notified once the email is delivered by setting the appropriate mail headers
email
- The email to send the send recipt toSets up a mail part that is TEXT using utf8 for you by calling addMailpart()
body
- The body content to set the mail part onRender or a view layout combination as the body for this email. If you use this, the `type` of the email will be set to `html` as well. You can also bind the view/layout with the args struct and use them accordingly. You can also use body tokens that the service will replace for you at runtime.
view
- The view to render as the bodyargs
- The structure of arguments to bind the view/layout withmodule
- Optional, the module the view is located inlayout
- Optional, If passed, we will render the view in this layoutlayoutModule
- Optional, If passed, the module the layout is inwirebox
Validate that the basic fields of from, to, and body are set for sending mail