T4VN is an online PHP Help community that provides PHP Tutorials, PHP Examples, PHP Scripts, PHP Support
    HOME  |  HOSTING COUPON  |  TEMPLATE  |  PHP SCRIPTS  |  LINK TO US  |  LINK  |  REGISTER | CONTACT
::: Member Login :::
 Username
 Password
 
Forgot your password ?
::: PHP Tutotal :::
  PHP Basic (7)
  PHP Advanced (4)
  PHP Database (2)
  Coding Step By Step (8)
  PHP and AJAX (0)
::: PHP Example :::
  Arrays (1)
  Code Highlighters (3)
  Database Functions (12)
  Date & Time (5)
  E-Mail (6)
  Forms (5)
  Guestbooks (1)
  Logging (2)
  Miscellaneous (10)
  Password Generators (3)
  Randomizers (3)
  String Manipulation (10)
  User Authentication (6)
::: Search On T4VN :::
::: T4VN Statistics :::
  PHP Scripts : 61
  PHP Example : 67
  PHP Tutorials : 21
  PHP News : 93
  Total Coupon : 36
  Other Tutorials :
  Member : 200
  Visitor Online : 2
  Today Visit: 216
  Total Visitor : 229493
  Most Online : 31
::: Sponsored Links :::

PR 4 For This Webpage
Home Today :

Simple Mail class

Author : gesf

A very, very simple mail class! So simple that doesn't justify its use anyway... it can be a open-eyes for those who want to start working with classes!

PHP Example :

<?

class minimail 

// Private variable. 
// Assigns email parameters. 
var $data = array(); 

// Constructs a minimail object. 
function minimail($to$subject$message$from){ 

// Creates message. 
// Adds a "To" address. 
$this->data['to'] = $to
// Adds a "Subject" line. 
$this->data['subject'] = $subject
// Adds a "body" line. 
$this->data['message'] = $message
// Adds a "From" address. 
$this->data['from'] = $from

// Call send() function. 
$this->send(); 


// Sends mail using the mail program. 
// Return true, otherwise call mail_error()! 
function send(){ 
$mail = @mail($this->data['to'], $this->data['subject'], $this->data['message'], 'From: '.$this->data['from']); 

if(!
$mail){ 
$error 'Error sending message!'
$this->mail_error($error); 

return 
true


// Output the error message and terminate the script! 
function mail_error($error){ 
die(
$error); 

}

?>



USAGE:

PHP Example :

<?
$mail 
= new minimail('someone@someone.com''Test' ,'testing...''you@you.com'); 
print (
$mail->send()) ? 'Message has been sent !' 'Error sending message !';
?>


Other Example
Display Emails (PHP)
Mail with attachments
Sending HTML email


::: Resources :::
  Links Directory
  Programming 2 3
  Webmaster 2 3
  Web Design 2 3
  Web Hosting 2 3
  Other Links 2 3
  Asian ShowBiz News
  Teach Seo For You
::: New Templates :::




::: Other Tutorials :::
 Program Design

  Powered By T4VN.NET - Version 2.0 - CopyRight © T4VN.NET 2005-2007