承接 cogitium/cogimail 相关项目开发

从需求分析到上线部署,全程专人跟进,保证项目质量与交付效率

邮箱:yvsm@zunyunkeji.com | QQ:316430983 | 微信:yvsm316

cogitium/cogimail

Composer 安装命令:

composer require cogitium/cogimail

包简介

Simple PHP class to send email to different address with files attached

README 文档

README

Class Features

  • A simple code for sending email from PHP
  • Send emails with multiple TOs, CCs, BCCs
  • Send emails with personal sender informations and specific REPLY-TO
  • Multipart/alternative emails for mail clients that do not read HTML email
  • Possible to join many files to the email
  • Error messages in english only
  • Generate exception if a trouble appears
  • Compatible with PHP 5.0 and later

Why you might need it

Many PHP developers use email in their code. The only PHP function that supports this is the mail() function. However, it does not provide any assistance for making use of popular features such as HTML-based emails and attachments.

Formatting email correctly is surprisingly difficult. There are myriad overlapping RFCs, requiring tight adherence to horribly complicated formatting and encoding rules - the vast majority of code that you'll find online that uses the mail() function directly is just plain wrong. Please don't be tempted to do it yourself - if you don't use CogiMail, there are many other excellent libraries that you should look at before rolling your own - try PhpMailer, SwiftMailer, Zend_Mail, eZcomponents etc.

In this version, you need to have a SMTP local server to use the component.

License

Coming soon.

Installation & loading

At the moment, you just have to copy the class file in the folder you want.

What's included

Within the download you'll find the following directories and files. You'll see something like this:

cogimail/
├── bat/
│   ├── checkstyle.bat
│   ├── phpdoc.bat
├── class/
│   └── CogiMail.class.js
├── doc/
│   ├── ...
│   └── index.html
├── psr/
│   ├── ...
│   └── index.html
└── test/
    ├── testCogiMail.php
    ├── image1.jpg
    ├── image2.gif
    ├── image3.png
    ├── image4.jpeg
    ├── fichier1.pdf
    └── fichier2.doc

A Simple Example

<?php
    require_once("../class/CogiMail.class.php");
    try {
        /**
         * Initialize the email and the sender detail
         */
        $mail = new CogiMail("sender@mail.com","Sender Name","replyto@mail.com");

        /**
         * Use the setters
         */
        $mail->addRecipientEmail('recipient1@mail.com');
        $mail->addRecipientEmail('recipient2@mail.com');
        $mail->addBccRecipientMail('bcc_recipient1@mail.com');
        $mail->addBccRecipientMail('bcc_recipient2@mail.com');
        $mail->addFile('file1.jpg');
        $mail->addFile('file2.gif');
        $mail->addFile('file3.png');
        $mail->addFile('file4.jpeg');
        $mail->addFile('file5.pdf');
        $mail->addFile('file6.doc');

        /**
         * Initialize the content
         */
        $mailObject = 'Object of the email';
     
        $plainTextContent = 'Example,'."\n\n".'With only plain text'; 

        $htmlContent =  '<html> 
                            <body>
                                <h1>Example</h1>
                                <p>
                                    A text with a  
                                    <strong>HTML</strong> 
                                    content
                                </p>
                            </body> 
                        </html>'; 

        $mail->contentMail($mailObject, $plainTextContent, $htmlContent);

        /**
         * Send the mail
         */
        $mail->sendMail();

        echo "<p>Very good, the email was sent !</p>";
        $mail->debug();

    } catch(Exception $e) {

        echo '<p>Exception' . $e->getMessage() . '</p>';
        $mail->debug();
    }
?>

That's it. You should now be ready to use CogiMail !

Localization

English only at this time.

Documentation

The complete documentation is in the doc folder.

Tests

There is a test page in the test folder to try the component.

Contributing

An idea or a comment, please email to Philippe

Changelog

See changelog.

History

  • At the beginning, CogiMail was a procedural function in a PHP library.
  • Then, this function became a Class.
  • Now, CogiMail is in a BitBucket repository.
  • With Readme, and a PhpDocumentor folder.
  • And Cherry on the Cake, there is a PSR folder to see the quality of the code ;-)

统计信息

  • 总下载量: 29
  • 月度下载量: 0
  • 日度下载量: 0
  • 收藏数: 0
  • 点击次数: 3
  • 依赖项目数: 0
  • 推荐数: 0

GitHub 信息

  • Stars: 0
  • Watchers: 0
  • Forks: 0
  • 开发语言: PHP

其他信息

  • 授权协议: MIT
  • 更新时间: 2016-12-02

承接程序开发

PHP开发

VUE

Vue开发

前端开发

小程序开发

公众号开发

系统定制

数据库设计

云部署

网站建设

安全加固