\org_openpsa_mail

Class for handling email sending

Sending Mails

Currently, the engine will send the emails through an autodetected transport, which can be either SMTP, Sendmail or PHP's mail() function (in that order).

Example usage code

$mail = new org_openpsa_mail();

$mail->from = 'noreply@openpsa2.org'; $mail->subject = $this->_config->get('mail_from'); $mail->body = $this->_config->get('mail_body'); $mail->to = $this->_person->email;

if (!$mail->send()) { debug_add("Email could not be sent: " . $mail->get_error_string(), MIDCOM_LOG_WARN); }

Summary

Methods
Properties
Constants
__construct()
__get()
__isset()
set_active_leaf()
add_stylesheet()
get_workflow()
__set()
send()
embed_images()
get_error_message()
$_component
$body
$headers
$html_body
$parameters
$attachments
$encoding
$allow_only_html
$bcc
$cc
$from
$subject
$to
$_i18n
$_l10n
$_l10n_midcom
$_config
No constants found
No protected methods found
No protected properties found
N/A
html2text()
_prepare_message()
$_services
$_do_image_embedding
$_backend
N/A

Properties

$_component

$_component : string

The name of the component, e.g. net.nehmer.static. Should be used whenever the component's name is required instead of hardcoding it.

Type

string

$body

$body : string

Text body

Type

string

$headers

$headers : array

key is header name, value is header data

Type

array

$html_body

$html_body : string

HTML body (of MIME/multipart message)

Type

string

$parameters

$parameters : array

The parameters to use for the Mail template.

Type

array

$attachments

$attachments : array

Primary keys are int, secondary keys for decoded array are:

'name' (filename) 'content' (file contents) 'mimetype' Array for encoding may instead of 'content' have 'file' which is path to the file to be attached

Type

array

$encoding

$encoding : string

Character encoding in which the texts etc are

Type

string

$allow_only_html

$allow_only_html : boolean

Allow to send only HTML body

Type

boolean

$bcc

$bcc : mixed

BCC address(es)

Type

mixed

$cc

$cc : mixed

CC address(es)

Type

mixed

$from

$from : mixed

From address(es)

Type

mixed

$subject

$subject : string

Subject line

Type

string

$to

$to : mixed

To address(es)

Type

mixed

$_i18n

$_i18n : \midcom_services_i18n

A handle to the i18n service.

Type

\midcom_services_i18n

$_l10n

$_l10n : \midcom_services_i18n_l10n

The components' L10n string database.

Type

\midcom_services_i18n_l10n

$_l10n_midcom

$_l10n_midcom : \midcom_services_i18n_l10n

The global MidCOM string database.

Type

\midcom_services_i18n_l10n

$_config

$_config : \midcom_helper_configuration

The current configuration.

Type

\midcom_helper_configuration

$_services

$_services : array

Array that holds the already instantiated services

Type

array

$_do_image_embedding

$_do_image_embedding : boolean

shall embed_images be called by message class?

Type

boolean

Methods

__construct()

__construct(  $backend = 'try_default',   $backend_params = array()) 

Parameters

$backend
$backend_params

__get()

__get(  $name) 

Make it possible to get header values via $mail->to and the like

Parameters

$name

__isset()

__isset(  $field) 

Parameters

$field

set_active_leaf()

set_active_leaf(  $leaf_id) 

Parameters

$leaf_id

add_stylesheet()

add_stylesheet(string  $url, string  $media = false) 

Convenience shortcut for adding CSS files

Parameters

string $url

The stylesheet URL

string $media

The media type(s) for the stylesheet, if any

get_workflow()

get_workflow(string  $identifier, array  $options = array()) : \midcom\workflow\dialog

Parameters

string $identifier
array $options

Returns

\midcom\workflow\dialog

__set()

__set(  $name,   $value) 

Make it possible to set header values via $mail->to and the like

Parameters

$name
$value

send()

send() 

Sends the email

embed_images()

embed_images() 

get_error_message()

get_error_message() 

Get error message from mail class

html2text()

html2text(  $html) 

Tries to convert HTML to plaintext

Parameters

$html

_prepare_message()

_prepare_message() 

Prepares message for sending

Calls MIME etc encodings as necessary.