PHP Classes

PHP Mail Class: Compose and send email using mail function or SMTP

Recommend this page to a friend!
     
  Info   Example   View files Files   Install with Composer Install with Composer   Download Download   Reputation   Support forum   Blog    
Ratings Unique User Downloads Download Rankings
Not enough user ratingsTotal: 398 All time: 6,590 This week: 45Up
Version License PHP version Categories
php-mail-class 1.0.0MIT/X Consortium ...5Email, Networking, PHP 5
Description 

Author

This class can compose and send email using mail function or SMTP.

It can compose a message by setting several types of parameters like the sender and recepient names and addresses, the message subject and body in text or HTML formats, etc..

The class can send the message either using the PHP mail() function or connecting to a SMTP server to relay the message.

Picture of Muhammad Umer Farooq
Name: Muhammad Umer Farooq is available for providing paid consulting. Contact Muhammad Umer Farooq .
Classes: 52 packages by
Country: Pakistan Pakistan
Age: 23
All time rank: 84310 in Pakistan Pakistan
Week rank: 214 Up4 in Pakistan Pakistan Up
Innovation award
Innovation award
Nominee: 6x

Recommendations

password authentication email
I want email to send to users after authentication

EMAIL with PDF Attachment
I want to send a invoice PDF file via email

Example

<?php

require_once 'Classes/Mail.php';

//Example using php mailer
$mail = new Mail;
//Set subject and sender of the mail.
$mail->setSubject('Example mail');
$mail->setSender('mail@example.com');
//Set the plain content of the mail.
$mail->setContentPlain('Example plain-content!');
//Add a receiver of the mail (you can add more than one receiver too).
$mail->addReceiver('example@gmail.com');
//Finally send the mail.
var_dump($mail->send());

//Example using smtp
$mail = new Mail;

//Set subject and sender of the mail.
$mail->setSubject('Example mail');
$mail->setSender('example@gmail.com');
//Set the plain content of the mail.
$mail->setContentPlain('Example plain-content!');
//Add a receiver of the mail (you can add more than one receiver too).
$mail->addReceiver('lablnet01@gmail.com');

$mail->isSMTP(true,['host'=>"mx1.hostinger.ae
"
,'user'=>'mail@hostinger.com','pass'=>'hostinger','port'=>587]);
//Finally send the mail.
var_dump($mail->send());


Details

PHP MAil Class

It can currently.

  • Send mail over php
  • Send mail over SMTP

  Files folder image Files (4)  
File Role Description
Files folder imageClasses (1 file)
Accessible without login Plain text file index.php Example Example script
Accessible without login Plain text file LICENCE Lic. License text
Accessible without login Plain text file readme.md Doc. Documentation

  Files folder image Files (4)  /  Classes  
File Role Description
  Plain text file Mail.php Class Class source

The PHP Classes site has supported package installation using the Composer tool since 2013, as you may verify by reading this instructions page.
Install with Composer Install with Composer
 Version Control Unique User Downloads Download Rankings  
 100%
Total:398
This week:0
All time:6,590
This week:45Up