Skip to content

therahulprasad/oomail

Folders and files

NameName
Last commit message
Last commit date

Latest commit

 

History

11 Commits
 
 
 
 

Repository files navigation

NOTE:

  1. This code is not unit tested hence not production ready, use it at your own risk. (If you can write unit test cases, let me know we can still improve this code and make it production ready)
  2. It has some interesting features which are still lacking in latest email libraries
  3. You can still use it for learning purpose

OOMail - Next Generation Email library for PHP

Ab object oriented approach to mails in PHP. It gives you granular level control for sending an email. You can even reply to a recieved email using this library.

Features

1. Basic features which are needed in an email client like adding To, CC, BCC etc. 2. You can reply to a recieved email (You will need FileHadle of received email file or RAW email) 3. For multiple TO address Send Separately with different message-id or same message-id OR Do not send separetly 4. Security from header injection attack 5. Add a remote file as attachment using url of the file 6. Return-Path support (If delivery is failed which email should be notified) 7. Automatic MIME type detection of attachment 8. Automatic size detection of remote file before it is attached. If there is an attchement limit, oversized files wont be downloaded.

Usage

// Adding from header along with name
$obj->from(array('Your name'=> [email protected]));
// Adding from header just email
$obj->from('[email protected]');
// In Reply to (When replying to a mail) when you know message it
$obj->inReplyTo('Id-of-old-message');
// In Reply to (When replying to a mail) when you have message saved
$fd = fopen('old-mail.eml', 'r');
$obj->inReplyTo($fd);
// In Reply to (When replying to a mail) when you have message content
$obj->inReplyTo('content of the mail'); // Will work only if message cotains proper headers
// To > Just email
$obj->to('[email protected]');
// To > Name and email
$obj->to(array('Your name' => '[email protected]'));
// To > Multiple recepient > Name and email
$obj->to(array('Your name 1' => '[email protected]', 'Your name 2' => '[email protected]'));
// To > Multiple recepient > email
$obj->to(array('[email protected]', '[email protected]'));
// Send separately to each TO-Recepient
$obj->sendSeparetely(TRUE);
// Do not Send separately to each TO-Recepient
$obj->sendSeparetely(FALSE);
// Send separately to each TO-Recepient & Regenerate message-id for each email
$obj->sendSeparetely(TRUE, TRUE);
// Send separately to each TO-Recepient & Keep same message-id for each email
$obj->sendSeparetely(TRUE, FALSE);
// Subject
$obj->subject('Your subject');
// CC > Just email
$obj->cc('[email protected]');
// CC > Name and email
$obj->cc(array('Your name' => '[email protected]'));
// CC > Multiple recepient > Name and email
$obj->cc(array('Your name 1' => '[email protected]', 'Your name 2' => '[email protected]'));
// CC > Multiple recepient > email
$obj->cc(array('[email protected]', '[email protected]'));
// BCC > Just email
$obj->bcc('[email protected]');
// BCC > Name and email
$obj->bcc(array('Your name' => '[email protected]'));
// BCC > Multiple recepient > Name and email
$obj->bcc(array('Your name 1' => '[email protected]', 'Your name 2' => '[email protected]'));
// BCC > Multiple recepient > email
$obj->bcc(array('[email protected]', '[email protected]'));
// Reply to > Just email
$obj->replyTo('[email protected]');
// Reply To > Name and email
$obj->replyTo('Your name', '[email protected]');

// TODO: Complete DOCUMENTATION

About

Object oriented mail for php

Resources

Stars

Watchers

Forks

Releases

No releases published

Packages

No packages published

Languages