[ Index ]
 

Code source de LifeType 1.2.4

Accédez au Source d'autres logiciels libres

Classes | Fonctions | Variables | Constantes | Tables

title

Body

[fermer]

/class/mail/ -> emailservice.class.php (sommaire)

\defgroup Mail Module that allows to easily send email messages from within pLog. The actual email sending is carried out via the PHPMailer package (http://phpmailer.sourceforge.net/) and the classes of this module are just commodity wrappers around PHPMailer.

Poids: 206 lignes (7 kb)
Inclus ou requis:0 fois
Référencé: 6 fois
Nécessite: 0 fichiers

Définit 1 class

EmailService:: (3 méthodes):
  EmailService()
  sendMessage()
  getLastErrorMessage()


Classe: EmailService  - X-Ref

\ingroup Mail

Provides services to send emails via PHPs built-in smtp capabilities.

This service can be enabled or disabled by using the "email_service_enabled" from
the configuration file. It also requires PHP to be built with the smtp handling
libraries and those must be enabled.

An example of how to send an email message is as follows:

<pre>
$message = new EmailMessage();
$message->addTo( "address1@domain.com" );
$message->addFrom( "myself@myself.com" );
$message->setSubject( "This is a sample message" );
$message->setBody( "this is the body of the message" );
$service = new EmailService();
if( $service->sendMessage( $message ))
print( "message sent ok!" );
else
print( "error sending message" );
</pre>

The EmailService class hides all the details about how the message is sent, the mechanism, etc.
It wil in fact use certain configuration parameters such as:

- email_service_enabled to determine whether emails should be sent at all.
- email_service_type can be one of these four values:
# php (requires PHP's mail() function)
# smtp (see below)
# qmail
# sendmail

If email_service_type is set as <b>smtp</b>, the following settings are also required:

- smtp_host name of the host used for sending the messages
- smtp_port port where the SMTP is listening, 25 by default
- smtp_use_authentication Wether we should perform some basic authentication agains the host

If smtp_use_authentication is set to yes, the following settings will determine the right
username and password to use:

- smtp_username
- smtp_password
EmailService()   X-Ref
Constructor


sendMessage( $message )   X-Ref
Sends the given message.

param: message Object from the EmailMessage class that encapsulates all the different fields
return: Returns true if operation was successful or false otherwise.

getLastErrorMessage()   X-Ref
Returns the last error message

return: A string containing the last error message, if any



Généré le : Mon Nov 26 21:04:15 2007 par Balluche grâce à PHPXref 0.7
  Clicky Web Analytics