Giter Site home page Giter Site logo

smtpclient's Introduction

SMTP Client Build Status

Just a powerful Service Mail Transfer Protocol (SMTP) client to send mail messages.
"This is a specific guy for send mail messages over SMTP, isn't a universal mailer that covers all methods for sending a mail"

How it works.

In a simple and robustly way, you could send mail messages using SMTP servers, firstly you need to create an connection, and perform authentication for the user, after that, send the message, and done.

Firstly we need a SMTP server, we'll use the gmail server. Using the settings from "Outgoing Mail (SMTP) Server" from Google, we'll perform the connection and authentication for the user.

<?php

require_once "config/bootstrap.php";

use utils\net\SMTP\Client; // SMTP client
use utils\net\SMTP\Client\Authentication\Login; // authentication mechanism
use utils\net\SMTP\Client\Connection\SSLConnection; // the connection
use utils\net\SMTP\Message; // the message

$client = new Client(new SSLConnection("smtp.gmail.com", 465));
$client->authenticate(new Login("[email protected]", "pswd"));

With that, we're connected and probably authenticated (if you replaced the [email protected] and pswd with valid credentials).
Then, just send the message.

$message = new Message();
$message->from("[email protected]") // sender
        ->to("[email protected]") // receiver
        ->subject("Hello") // message subject
        ->body("Hello World"); // message content

echo $client->send($message) ? "Message sent" : "Opz";

Be happy if the message was sent.
Otherwise, you can open a issue here if you can't identify the problem type (e.g: credentials, connection [host, port]) to resolve it.

How i could use/test ?

Firstly, clone the repository.

$ git clone git://github.com/andreyknupp/SMTPClient.git
$ cd SMTPClient/

Switch the current directory to SMTPClient directory.

$ cd SMTPClient/

Install dependencies via composer.

$ curl -s http://getcomposer.org/installer | php
$ php composer.phar install

Performing unit tests isn't possible currently, but in the future, you can.
Thanks, you're free to contribute with anything you think can.

Recommend Projects

  • React photo React

    A declarative, efficient, and flexible JavaScript library for building user interfaces.

  • Vue.js photo Vue.js

    ๐Ÿ–– Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.

  • Typescript photo Typescript

    TypeScript is a superset of JavaScript that compiles to clean JavaScript output.

  • TensorFlow photo TensorFlow

    An Open Source Machine Learning Framework for Everyone

  • Django photo Django

    The Web framework for perfectionists with deadlines.

  • D3 photo D3

    Bring data to life with SVG, Canvas and HTML. ๐Ÿ“Š๐Ÿ“ˆ๐ŸŽ‰

Recommend Topics

  • javascript

    JavaScript (JS) is a lightweight interpreted programming language with first-class functions.

  • web

    Some thing interesting about web. New door for the world.

  • server

    A server is a program made to process requests and deliver data to clients.

  • Machine learning

    Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.

  • Game

    Some thing interesting about game, make everyone happy.

Recommend Org

  • Facebook photo Facebook

    We are working to build community through open source technology. NB: members must have two-factor auth.

  • Microsoft photo Microsoft

    Open source projects and samples from Microsoft.

  • Google photo Google

    Google โค๏ธ Open Source for everyone.

  • D3 photo D3

    Data-Driven Documents codes.