You have been redirected from an outdated version of the article. Below is the content available on this topic. To view the old article click here.

mail_begin()

Usage

mail_begin(fromAddress[, fromName[, subject[, htmlContent[, textContent[, files]]]]])

Description

Begins an HTML e-mail with the basic given configuration. See Mail Configuration for more information. The e-mail methods are the main use-case for the template() method. The recipients are added via the mail_add_to(), mail_add_cc() and mail_add_bcc() functions. This is separated out to allow for emails with only CC and/or BCC addresses.

An optional list of files (instances of File) can be passed to the command. The files will be sent as e-mail attachments. For more granular control the mail_add_attachment() function can be used.

This is a convenience method where we can supply multiple parameters at once. Alternatively we can use mail_set_from(), mail_set_subject(), mail_set_html_content(), mail_set_text_content() and mail_add_attachment(). This is especially helpful if we are trying to send a series of mails with nearly identical content.

Note

  • This function initially clears the current mail completely
  • Attachments have to be provided as a list - even if only one file should be attached.

Example

${mail_begin('info@structr.com', 'Structr', 'Welcome to Structr', 'Hi User, welcome to Structr!')}

Search results for "mail_begin()"

mail_begin()

Begins an HTML e-mail with the basic given configuration. See Mail Configuration for more information. The e-mail methods are the main use-case for the template() method. The recipients are added via the mail_add_to(), mail_add_cc() and mail_add_bcc() functions. This is separated out to allow for emails with only CC and/or BCC addresses.
An optional list of files (instances of File) can be passed to the command. The files will be sent as e-mail attachments. For more granular control the mail_add_attachment() function can be used.
This is a convenience method where we can supply multiple parameters at once. Alternatively we can use mail_set_from(), mail_set_subject(), mail_set_html_content(), mail_set_text_content() and mail_add_attachment(). This is especially helpful if we are trying to send a series of mails with nearly identical content.

mail_begin(fromAddress [, fromName [, subject [, htmlContent [, textContent [, files]]]]] )