PHP Classes

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

Recommend this page to a friend!
  Info   View files Example   View files View files (4)   DownloadInstall with Composer Download .zip   Reputation   Support forum (2)   Blog    
Ratings Unique User Downloads Download Rankings
Not enough user ratingsTotal: 396 This week: 1All time: 6,597 This week: 560Up
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: 22
All time rank: 84611 in Pakistan Pakistan
Week rank: 52 Up3 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  
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  /  Classes  
File Role Description
  Plain text file Mail.php Class Class source

 Version Control Unique User Downloads Download Rankings  
 100%
Total:396
This week:1
All time:6,597
This week:560Up