XOOPS RMCommon Utilities  2.1.8.91RC
 All Classes Namespaces Files Functions Variables
RMMailer Class Reference

Public Member Functions

 __construct ($content_type= 'text/plain')
 
 add_bcc ($mail, $name='')
 
 add_cc ($mail, $name='')
 
 add_part ($content, $type='text/html')
 
 add_to ($mail, $name='')
 
 add_user ($mail, $name='', $field='to')
 
 add_users ($users, $field='to')
 
 add_xoops_users ($users, $field='to')
 
 assign ($var, $value)
 
 attach_content ($type='path', $path= '', $content_type= '', $name='', $content=null, $disposition='')
 
 batchSend ()
 
 create_body ()
 
 embed ($type, $file='', $name=null, $content_type=null)
 
 errors ()
 
 get_bcc ()
 
 get_body ()
 
 get_cc ()
 
 get_return_path ()
 
 get_subject ()
 
 get_to ()
 
message ()
 
 send ()
 
 send_pm ()
 
 set_bcc ($recipients=array())
 
 set_body ($body, $content_type='')
 
 set_cc ($recipients=array())
 
 set_from ($mail, $name)
 
 set_from_xuser ($user)
 
 set_return_path ($mail)
 
 set_subject ($subject)
 
 set_to ($recipients=array())
 
 template ($file, $type='')
 
transport ()
 

Private Attributes

 $errors = array()
 
 $swMailer
 
 $swMessage
 
 $swTransport
 
 $template = ''
 
 $tpl_type = ''
 
 $vars = array()
 
 $xusers = array()
 

Detailed Description

Definition at line 21 of file mailer.php.

Constructor & Destructor Documentation

RMMailer::__construct (   $content_type = 'text/plain')

Class constructor. Load all data from configurations and generate the initial clases to manage the email

Parameters
stringContent type for message body. It usually text/plain or text/html. Default is 'text/plain' but can be changed later

Definition at line 55 of file mailer.php.

References RMFunctions\configs(), Swift_MailTransport\newInstance(), Swift_SendmailTransport\newInstance(), Swift_SmtpTransport\newInstance(), and Swift_Message\newInstance().

Here is the call graph for this function:

Member Function Documentation

RMMailer::add_bcc (   $mail,
  $name = '' 
)

Definition at line 290 of file mailer.php.

Referenced by add_user().

Here is the caller graph for this function:

RMMailer::add_cc (   $mail,
  $name = '' 
)

Add single recipient

Parameters
stringEmail address
stringName

Definition at line 275 of file mailer.php.

Referenced by add_user().

Here is the caller graph for this function:

RMMailer::add_part (   $content,
  $type = 'text/html' 
)

Adds a part to message body.

Parameters
stringPart body content
stringContent type, default is text/html

Definition at line 161 of file mailer.php.

References $content, and $type.

RMMailer::add_to (   $mail,
  $name = '' 
)

Add single recipient

Parameters
stringEmail address
stringName

Definition at line 248 of file mailer.php.

Referenced by add_user().

Here is the caller graph for this function:

RMMailer::add_user (   $mail,
  $name = '',
  $field = 'to' 
)

Definition at line 318 of file mailer.php.

References $field, add_bcc(), add_cc(), and add_to().

Referenced by add_users(), and add_xoops_users().

Here is the call graph for this function:

Here is the caller graph for this function:

RMMailer::add_users (   $users,
  $field = 'to' 
)

Add Users as recipients for message. Users can be passed as object or as ids

Parameters
arrayUsers (ids or objects)

Definition at line 302 of file mailer.php.

References $field, $users, and add_user().

Here is the call graph for this function:

RMMailer::add_xoops_users (   $users,
  $field = 'to' 
)

Add xoops users object to recipients list

Parameters
mixedA xoopsuser object or an array of xoopsuser objects

Definition at line 337 of file mailer.php.

References $field, $users, and add_user().

Here is the call graph for this function:

RMMailer::assign (   $var,
  $value 
)

Definition at line 373 of file mailer.php.

RMMailer::attach_content (   $type = 'path',
  $path = '',
  $content_type = '',
  $name = '',
  $content = null,
  $disposition = '' 
)

Attach a file Note: Always is preferible get the Message object and work directly with it and with Attachement object

Parameters
stringType of file. Can be 'path' for existent files or 'dynamic' for dynamic content
stringFile path, when type = 'path'. The file must exists. Also can be a URL
stringContent type for file (mime type)
stringSet file name in the message
mixedContent for dynamic content
stringFile disposition (inline)

Definition at line 176 of file mailer.php.

References $content, $path, $type, Swift_Attachment\fromPath(), and Swift_Attachment\newInstance().

Here is the call graph for this function:

RMMailer::batchSend ( )

Definition at line 451 of file mailer.php.

References create_body(), errors(), and Swift_Mailer\newInstance().

Here is the call graph for this function:

RMMailer::create_body ( )

Definition at line 396 of file mailer.php.

References $ret, $template, get_body(), and set_body().

Referenced by batchSend(), send(), and send_pm().

Here is the call graph for this function:

Here is the caller graph for this function:

RMMailer::embed (   $type,
  $file = '',
  $name = null,
  $content_type = null 
)

Embed files into message Note: Is better to use the Message object directly

Parameters
stringPath or dynamic
string|mixedPath to file or file content when type is dynamic
stringFile name
stringMime type of image
Returns
int

Definition at line 211 of file mailer.php.

References $file, $type, Swift_Image\fromPath(), and Swift_Image\newInstance().

Here is the call graph for this function:

RMMailer::errors ( )

Get errors

Returns
array

Definition at line 392 of file mailer.php.

References $errors.

Referenced by batchSend(), and send().

Here is the caller graph for this function:

RMMailer::get_bcc ( )

Definition at line 286 of file mailer.php.

RMMailer::get_body ( )

Returns the body content

Definition at line 140 of file mailer.php.

Referenced by create_body(), and send_pm().

Here is the caller graph for this function:

RMMailer::get_cc ( )

Get recipients for this message

Returns
array

Definition at line 266 of file mailer.php.

RMMailer::get_return_path ( )

Definition at line 369 of file mailer.php.

RMMailer::get_subject ( )

Get the subject line

Returns
string

Definition at line 123 of file mailer.php.

Referenced by send_pm().

Here is the caller graph for this function:

RMMailer::get_to ( )

Get recipients for this message

Returns
array

Definition at line 239 of file mailer.php.

& RMMailer::message ( )

Next functions allows to manage the Message object. You can obtain directly the Swift Message object and work directly with it. Get the message object

Returns
object

Definition at line 114 of file mailer.php.

References $swMessage.

RMMailer::send ( )

Definition at line 457 of file mailer.php.

References create_body(), errors(), and Swift_Mailer\newInstance().

Here is the call graph for this function:

RMMailer::send_pm ( )

Definition at line 427 of file mailer.php.

References create_body(), get_body(), and get_subject().

Here is the call graph for this function:

RMMailer::set_bcc (   $recipients = array())

Definition at line 281 of file mailer.php.

RMMailer::set_body (   $body,
  $content_type = '' 
)

Set the body content and additionally can set the content_type If content type is not provided then it leaves without changes

Parameters
string$body
string$content_type

Definition at line 151 of file mailer.php.

Referenced by create_body().

Here is the caller graph for this function:

RMMailer::set_cc (   $recipients = array())

This methods are similar to previous but for Cc recipients

Parameters
arrayRecipientes data array('recip.nosp@m.ient.nosp@m.@addr.nosp@m.ess..nosp@m.com'=>'Recipient Name','recip.nosp@m.ent2.nosp@m.@addr.nosp@m.ess..nosp@m.com',...)

Definition at line 257 of file mailer.php.

RMMailer::set_from (   $mail,
  $name 
)

Definition at line 86 of file mailer.php.

RMMailer::set_from_xuser (   $user)

Definition at line 90 of file mailer.php.

References elseif().

Here is the call graph for this function:

RMMailer::set_return_path (   $mail)

Sets the return path

Parameters
stringEmail for return path

Definition at line 365 of file mailer.php.

RMMailer::set_subject (   $subject)

Set the subject line

Parameters
stringSubject line

Definition at line 132 of file mailer.php.

RMMailer::set_to (   $recipients = array())

set all recipients in one go

Parameters
arrayRecipientes data array('recip.nosp@m.ient.nosp@m.@addr.nosp@m.ess..nosp@m.com'=>'Recipient Name','recip.nosp@m.ent2.nosp@m.@addr.nosp@m.ess..nosp@m.com',...)

Definition at line 230 of file mailer.php.

RMMailer::template (   $file,
  $type = '' 
)

Assign a template to generate the message body

Parameters
stringPath to file
stringTemplate type. It can be "old" or ''

Definition at line 383 of file mailer.php.

References $file.

& RMMailer::transport ( )

Creating the mail transport

Definition at line 100 of file mailer.php.

References $swTransport.

Member Data Documentation

RMMailer::$errors = array()
private

Errors when sending

Definition at line 38 of file mailer.php.

Referenced by errors().

RMMailer::$swMailer
private

The mailet class

Definition at line 34 of file mailer.php.

RMMailer::$swMessage
private

The message class

Definition at line 30 of file mailer.php.

Referenced by message().

RMMailer::$swTransport
private

The transport class

Definition at line 26 of file mailer.php.

Referenced by transport().

RMMailer::$template = ''
private

Definition at line 41 of file mailer.php.

Referenced by create_body().

RMMailer::$tpl_type = ''
private

Definition at line 42 of file mailer.php.

RMMailer::$vars = array()
private

Definition at line 40 of file mailer.php.

RMMailer::$xusers = array()
private

Definition at line 44 of file mailer.php.


The documentation for this class was generated from the following file: