WebFioriAPI ReferenceLearnDownloadContributeLearn{{result.parent_page}} > {{result.title}}{{result.title}}Classes{{result.class_name}}{{result.summary}}Methods{{result.name}}{{result.summary}}

namespace \webfiori\framework\mail

class EmailMessage

Class Attributes Summary

const PRIORITIESA constant that colds the possible values for the header 'Priority'.

Class Methods Summary

public function __construct(string$sendAccountName)Creates new instance of the class.public function addAttachment(File|string$fileObjOrFilePath)Adds a file as email attachment.public function addBCC(string$address, string$name)Adds new receiver address to the list of 'bcc' receivers.public function addBeforeSend(Callable$callback, array$extraParams)Adds a callback to execute before the message is sent.public function addCC(string$address, string$name)Adds new receiver address to the list of 'cc' receivers.public function addTo(string$address, string$name)Adds new receiver address to the list of 'to' receivers.public function get(string$label)Returns the value of a language label.public function getBCC()Returns an associative array that contains the names and the addresses of people who will receive a blind carbon copy of the message.public function getBCCStr()Returns a string that contains the names and the addresses of people who will receive a blind carbon copy of the message.public function getCC()Returns an associative array that contains the names and the addresses of people who will receive a carbon copy of the message.public function getCCStr()Returns a string that contains the names and the addresses of people who will receive a carbon copy of the message.public function getChildByID(string$id)Returns a child node given its ID.public function getDocument()Returns the document that is associated with the page.public function getLang()Returns the language code of the email.public function getLog()Returns an array that contains log messages which are generated from sending SMTP commands.public function getPriority()Returns the priority of the message.public function getSMTPAccount()public function getSMTPServer()Returns an object that holds SMTP server information.public function getSubject()Returns the subject of the email.public function getTo()Returns an associative array that contains the names and the addresses of people who will receive an original copy of the message.public function getToStr()Returns a string that contains the names and the addresses of people who will receive an original copy of the message.public function getTranslation()Returns an object which holds i18n labels.public function insert(HTMLNode|string$node, string|null$parentNodeId)Adds a child node inside the body of a node given its ID.public function send()Sends the message and set message instance to null.public function setLang(string$lang)Sets the display language of the email.public function setPriority(int$priority)Sets the priority of the message.public function setSubject(string$subject)Sets the subject of the message.

Class Attributes Details

const PRIORITIESA constant that colds the possible values for the header 'Priority'.

Class Methods Details

public function __construct(string$sendAccountName)Creates new instance of the class.

Parameters:

  • string $sendAccountName The name of SMTP connection that will be used to send the message. It must exist in the class 'AppConfig'. Default value is 'no-reply'.
public function addAttachment(File|string$fileObjOrFilePath)Adds a file as email attachment.

Parameters:

  • File|string $fileObjOrFilePath An object of type 'File'. This also can be the absolute path to a file in the file system.
Returns: booleanIf the file is added, the method will return true. Other than that, the method will return false.
public function addBCC(string$address, string$name)Adds new receiver address to the list of 'bcc' receivers.

Parameters:

  • string $address The email address of the receiver (such as 'example
  • string $name An optional receiver name. If not provided, the email address is used as name.
Returns: booleanIf the address is added, the method will return true. False otherwise.
public function addBeforeSend(Callable$callback, array$extraParams)Adds a callback to execute before the message is sent.

Parameters:

  • Callable $callback A function that will get executed before sending the message. Note that the first parameter of the callback will be always the message (e.g. function (EmailMessage $message) {})
  • array $extraParams An optional array of extra parameters that will be passed to the callback.
public function addCC(string$address, string$name)Adds new receiver address to the list of 'cc' receivers.

Parameters:

  • string $address The email address of the receiver (such as 'example
  • string $name An optional receiver name. If not provided, the email address is used as name.
Returns: booleanIf the address is added, the method will return true. False otherwise.
public function addTo(string$address, string$name)Adds new receiver address to the list of 'to' receivers.

Parameters:

  • string $address The email address of the receiver (such as 'example
  • string $name An optional receiver name. If not provided, the email address is used as name.
Returns: booleanIf the address is added, the method will return true. False otherwise.
public function get(string$label)Returns the value of a language label.

Parameters:

  • string $label A directory to the language variable (such as 'pages/login/login-label').
Returns: string|arrayIf the given directory represents a label, the method will return its value. If it represents an array, the array will be returned. If nothing was found, the returned value will be the passed value to the method.
public function getBCC()Returns an associative array that contains the names and the addresses of people who will receive a blind carbon copy of the message. The indices of the array will act as the addresses of the receivers and the value of each index will contain the name of the receiver.Returns: arrayAn array that contains receivers information.public function getBCCStr()
Returns a string that contains the names and the addresses of people who will receive a blind carbon copy of the message. The format of the string will be as follows:

NAME_1 <ADDRESS_1>, NAME_2 <ADDRESS_2> ...

Returns: stringA string that contains receivers information.
public function getCC()Returns an associative array that contains the names and the addresses of people who will receive a carbon copy of the message. The indices of the array will act as the addresses of the receivers and the value of each index will contain the name of the receiver.Returns: arrayAn array that contains receivers information.public function getCCStr()
Returns a string that contains the names and the addresses of people who will receive a carbon copy of the message. The format of the string will be as follows:

NAME_1 <ADDRESS_1>, NAME_2 <ADDRESS_2> ...

Returns: stringA string that contains receivers information.
public function getChildByID(string$id)Returns a child node given its ID.

Parameters:

  • string $id The ID of the child.
Returns: null|HTMLNodeThe method returns an object of type HTMLNode. if found. If no node has the given ID, the method will return null.
public function getDocument()Returns the document that is associated with the page. Returns: HTMLDocAn object of type 'HTMLDoc'.public function getLang()Returns the language code of the email. Returns: string|nullTwo digit language code. In case language is not set, the method will return nullpublic function getLog()Returns an array that contains log messages which are generated from sending SMTP commands. Returns: arrayThe array will be indexed. In every index, there will be a sub-associative array with the following indices:
  • command
  • response-code
  • response-message
public function getPriority()Returns the priority of the message. Returns: intThe priority of the message. -1 for non-urgent, 0 for normal and 1 for urgent. Default value is 0.public function getSMTPAccount()Returns: SMTPAccount public function getSMTPServer()Returns an object that holds SMTP server information. The returned instance can be used to access SMTP server messages log to see if the message was transfered or not. Note that the connection to the server will only be established once the method 'EmailMessage::send()'.Returns: SMTPServerAn instance which represents SMTP server.public function getSubject()Returns the subject of the email. Returns: stringThe subject of the email. Default return value is 'Hello From WebFiori Framework'.public function getTo()Returns an associative array that contains the names and the addresses of people who will receive an original copy of the message. The indices of the array will act as the addresses of the receivers and the value of each index will contain the name of the receiver.Returns: arrayAn array that contains receivers information.public function getToStr()
Returns a string that contains the names and the addresses of people who will receive an original copy of the message. The format of the string will be as follows:

NAME_1 <ADDRESS_1>, NAME_2 <ADDRESS_2> ...

Returns: stringA string that contains receivers information.
public function getTranslation()Returns an object which holds i18n labels. Returns: Language|nullThe returned object labels will be based on the language of the email. If no translation is loaded, the method will return null.public function insert(HTMLNode|string$node, string|null$parentNodeId)Adds a child node inside the body of a node given its ID.

Parameters:

  • HTMLNode|string $node The node that will be inserted. Also, this can be the tag name of the node such as 'div'.
  • string|null $parentNodeId The ID of the node that the given node will be inserted to. If null is given, the node will be added directly inside the element <body>. Default value is null.
Returns: HTMLNode|nullThe method will return the inserted node if it was inserted. If it is not, the method will return null.
public function send()Sends the message and set message instance to null. public function setLang(string$lang)Sets the display language of the email. The length of the given string must be 2 characters in order to set the language code.

Parameters:

  • string $lang a two digit language code such as AR or EN. Default value is 'EN'.
public function setPriority(int$priority)Sets the priority of the message.

Parameters:

  • int $priority The priority of the message. -1 for non-urgent, 0 for normal and 1 for urgent. If the passed value is greater than 1, then 1 will be used. If the passed value is less than -1, then -1 is used. Other than that, 0 will be used.
public function setSubject(string$subject)Sets the subject of the message.

Parameters:

  • string $subject Email subject.
mdi-menuAll Classesmdi-chevron-leftAnchorBrCodeSnippetHTMLDocHTMLListHTMLNodeHTMLTableHeadNodeInputJsCodeLabelListItemOrderedListParagraphRadioGroupTableCellTableRowUnorderedListInvalidNodeNameExceptionTemplateNotFoundExceptionCaseConverterJsonJsonConverterJsonIJsonTypesPropertyAPIFilterAbstractWebServiceManagerInfoServiceParamTypesRequestRequestParameterResponseUriWebServicesManagerAccessAutoLoaderConfigConfigControllerDBEAbstractWebServiceExtendedWebServicesManagerFileLoggerPrivilegePrivilegesGroupThemeThemeLoaderUploadFileUploaderUserUtilWebFioriAppLanguageErrorBoxHTTPCodeViewMessageBoxServerErrViewStarterPageWebPageDatabaseSessionStorageDefaultSessionStorageMSSQLSessionDataTableMSSQLSessionsTableMySQLSessionDataTableMySQLSessionsTableSessionSessionOperationsSessionStorageSessionsManagerRouterRouterUriAbstractMiddlewareMiddlewareManagerEmailMessageSMTPAccountSMTPServerClassLoaderExceptionFileExceptionInitializationExceptionInvalidCRONExprExceptionMissingLangExceptionNoSuchThemeExceptionRoutingExceptionSMTPExceptionSessionExceptionUIExceptionAbstractJobCronCronEmailCronJobJobArgumentCronLoginViewCronTasksViewCronViewCronLoginServiceCronLogoutServiceCronServicesManagerForceCronExecutionServiceGetJobsServiceCLICLICommandInputStreamOutputStreamStdInStdOutClassWriterLangClassWriterQueryClassWriterServiceHolderThemeClassWriterWebServiceWriterCreateCLIClassHelperCreateCronJobCreateMiddlewareCreateTableCreateTableObjCreateThemeHelperCreateWebServiceAddCommandCreateCommandCronCommandHelpCommandListCronCommandListRoutesCommandListThemesCommandRunSQLQueryCommandSettingsCommandTestRouteCommandUpdateSettingsCommandUpdateTableCommandVersionCommandAbstractQueryColumnColumnFactoryConditionConnectionConnectionInfoDatabaseDatabaseExceptionDateTimeValidatorEntityMapperExpressionForeignKeyJoinTableResultSetSelectExpressionTableWhereExpressionMySQLColumnMySQLConnectionMySQLQueryMySQLTableMSSQLColumnMSSQLConnectionMSSQLQueryMSSQLTableAbstractCollectionComparableLinkedListNodeQueueStack
Powered By: WebFiori Framework, Vue and VuetifyAll Rights Reserved © 2018 - 2024