Mailer class which should be used for all mail sending purposes.

package Core
subpackage Util
author Chris Corbyn

 Methods

Constructor

__construct(\Swift_Transport $transport) : void

Parameters

$transport

\Swift_Transport

[optional] the transport type

Tries to establish an SMTP connection with the given settings.

constructTransport(string $mailHost, string $mailPort, string $mailEncryption, string $mailUser, string $mailPass) : \Swift_SmtpTransport
Static

If this is possible, a Swift_SmtpTransport object is returned. Otherwise a simple Swift_MailTransport object is returned.

Parameters

$mailHost

string

the mail host

$mailPort

string

the mail port

$mailEncryption

string

[optional] the mail encryption

$mailUser

string

[optional] the mail user

$mailPass

string

[optional] the mail password

Returns

\Swift_SmtpTransportSwift_MailTransport the transport object

Create a new class instance of one of the message services For example 'mimepart' would create a 'message.mimepart' instance

createMessage(string $service) : object
Inherited
inherited_from \Swift_Mailer::createMessage()

Parameters

$service

string

Returns

object

The Transport used to send messages.

getTransport() : \Swift_Transport
Inherited
inherited_from \Swift_Mailer::getTransport()

Returns

Create a new Mailer instance.

newInstance(\Swift_Transport $transport) : \Swift_Mailer
InheritedStatic
inherited_from \Swift_Mailer::newInstance()

Parameters

$transport

\Swift_Transport

Returns

Register a plugin using a known unique key (e.g.

registerPlugin(\Swift_Events_EventListener $plugin) 
Inherited

myPlugin).

inherited_from \Swift_Mailer::registerPlugin()

Parameters

Resends the mail with the given idmailsuccess.

resendMail(int $idmailsuccess) 

Parameters

$idmailsuccess

int

the ID of the mail which should be resend

Exceptions

\cInvalidArgumentException if the mail has already been sent successfully or does not exist

Sends the given Swift_Mime_Message and logs it if $resend is false.

send(\Swift_Mime_Message $message, array $failedRecipients, $resend) : int

All recipients (with the exception of Bcc) will be able to see the other recipients this message was sent to.

Recipient/sender data will be retrieved from the Message object.

The return value is the number of recipients who were accepted for delivery.

see \Swift_Mailer::send()

Parameters

$failedRecipients

array

&$failedRecipients, optional

$resend

Returns

int

Wrapper function for sending a mail.

sendMail(string | array $from, string | array $to, string $subject, string $body, string | array $cc, string | array $bcc, string | array $replyTo, bool $resend, $contentType) : int

All parameters which accept mail addresses also accept an array where the key is the email address and the value is the name.

Parameters

$from

stringarray

the sender of the mail, if something "empty" is given, default address from CONTENIDO system settings is used

$to

stringarray

one or more recipient addresses

$subject

string

the subject of the mail

$body

string

[optional] the body of the mail

$cc

stringarray

[optional] one or more recipient addresses which should get a normal copy

$bcc

stringarray

[optional] one or more recipient addresses which should get a blind copy

$replyTo

stringarray

[optional] address to which replies should be sent

$resend

bool

[optional] whether the mail is resent

$contentType

Returns

intnumber of recipients to which the mail has been sent

Sets the charset of the messages which are sent with this mailer object.

setCharset(string $charset) 

If you want to use UTF-8, you do not need to call this method.

Parameters

$charset

string

the character encoding

Log the information about sending the email.

_logMail(\Swift_Message $message, array $failedRecipients) : \the

Parameters

$message

\Swift_Message

the message which has been send

$failedRecipients

array

[optional] the recipient addresses that did not get the mail

Returns

\theidmail of the inserted table row in con_mail_log

Decodes the given value / the given array values with html_entity_decode.

decodeField(string | array $value, string $charset) : string | array

Parameters

$value

stringarray

the value to decode

$charset

string

the charset to use in htmlentities

Returns

stringarraythe decoded value

Encodes the given value / the given array values with htmlentities.

encodeField(string | array $value, string $charset) : string | array

Parameters

$value

stringarray

the value to encode

$charset

string

the charset to use in htmlentities

Returns

stringarraythe encoded value

 Properties

 

$_mailEncryption : string
 

$_mailHost : string
 

$_mailPass : string
 

$_mailPort : int
 

$_mailSender : string
 

$_mailSenderName : string
 

$_mailUser : string
 

$_transport 
Inherited
inherited_from \Swift_Mailer::$$_transport