All Projects → snipworks → php-smtp

snipworks / php-smtp

Licence: MIT License
Simple PHP SMTP Mail Send Script

Programming Languages

PHP
23972 projects - #3 most used programming language

Labels

Projects that are alternatives of or similar to php-smtp

smtpdane
SMTP DANE testing tool
Stars: ✭ 15 (-73.68%)
Mutual labels:  smtp
docker-protonmail-bridge
Run ProtonMail Bridge in a docker container
Stars: ✭ 34 (-40.35%)
Mutual labels:  smtp
flask-admin-boilerplate
Flask Admin Boilerplate with MongoDB
Stars: ✭ 63 (+10.53%)
Mutual labels:  smtp
go-simple-mail
Golang package for send email. Support keep alive connection, TLS and SSL. Easy for bulk SMTP.
Stars: ✭ 298 (+422.81%)
Mutual labels:  smtp
yggmail
End-to-end encrypted email for the mesh networking age
Stars: ✭ 72 (+26.32%)
Mutual labels:  smtp
ebook
Third edition of the Computer Networking: Principles, Protocols and Practice ebook
Stars: ✭ 64 (+12.28%)
Mutual labels:  smtp
Mail
基于 Net.Mail 封装的发送邮件工具类。仅需一行代码,发送邮件。支持自定义邮件发出邮箱、发出方名字等。 支持SSL加密发送。 多个接收人、抄送人。支持群发独显。 支持添加附件、多个附件。 目前大部分主流邮箱全支持。
Stars: ✭ 87 (+52.63%)
Mutual labels:  smtp
haraka-plugin-mongodb
Plugin for the Haraka SMTP server to store incoming and outgoing emails to MongoDB
Stars: ✭ 25 (-56.14%)
Mutual labels:  smtp
Smtp-Cracker-V3
[NEW] : Simple Mail Transfer Protocol (SMTP) CHECKER - CRACKER Tool V3
Stars: ✭ 18 (-68.42%)
Mutual labels:  smtp
polog
Логирование должно быть красивым
Stars: ✭ 26 (-54.39%)
Mutual labels:  smtp
mailx
A lightweight SMTP mail library
Stars: ✭ 17 (-70.18%)
Mutual labels:  smtp
go-html-email
Sending HTML email using Go 💌
Stars: ✭ 31 (-45.61%)
Mutual labels:  smtp
dokku-posteio
Poste.io plugin for Dokku
Stars: ✭ 27 (-52.63%)
Mutual labels:  smtp
nestjs-mailer
🌈 A simple implementation example with and without email-templates using mailer module for nest js built on top of nodemailer.
Stars: ✭ 82 (+43.86%)
Mutual labels:  smtp
mailcat
Fake SMTP server that prints emails to stdout
Stars: ✭ 39 (-31.58%)
Mutual labels:  smtp
DANE-for-SMTP
'DANE for SMTP' wiki
Stars: ✭ 28 (-50.88%)
Mutual labels:  smtp
Contact-Form-PHP
Simple and secure contact form using Ajax, validations inputs, SMTP protocol and Google reCAPTCHA v3 in PHP.
Stars: ✭ 28 (-50.88%)
Mutual labels:  smtp
dist-detect
Try to determine what Linux/Unix distribution is running on a remote host and get a hint if security updates are applied.
Stars: ✭ 14 (-75.44%)
Mutual labels:  smtp
tmail
A throwaway smtp server with API
Stars: ✭ 13 (-77.19%)
Mutual labels:  smtp
smtp-dkim-signer
SMTP-proxy that DKIM-signs e-mails before submission to an upstream SMTP-server.
Stars: ✭ 28 (-50.88%)
Mutual labels:  smtp

PHP SMTP

An easy to use SMTP (Simple Mail Transfer Protocol) library which helps you to send emails.

Installation

composer require snipworks/php-smtp

Examples

Unsecured

<?php

use Snipworks\Smtp\Email;

$mail = new Email('smtp.example.com', 25);
$mail->setLogin('[email protected]', 'password');
$mail->addTo('[email protected]', 'Example Receiver');
$mail->setFrom('[email protected]', 'Example Sender');
$mail->setSubject('Example subject');
$mail->setHtmlMessage('<b>Example message</b>...');

if($mail->send()){
    echo 'Success!';
} else {
    echo 'An error occurred.';
}

Secured (TLS)

<?php

use Snipworks\Smtp\Email;

$mail = new Email('smtp.example.com', 587);
$mail->setProtocol(Email::TLS);
$mail->setLogin('[email protected]', 'password');
$mail->addTo('[email protected]', 'Example Receiver');
$mail->setFrom('[email protected]', 'Example Sender');
$mail->setSubject('Example subject');
$mail->setHtmlMessage('<b>Example message</b>...');

if($mail->send()){
    echo 'Success!';
} else {
    echo 'An error occurred.';
}

It's discouraged to hard-code the SMTP login credentials like in the examples above. It's recommended to put them inside another file and load it or set it to environment variable

<?php

// config.php

define('SMTP_PRIMARY_EMAIL', '[email protected]');
define('SMTP_PRIMARY_PASSWORD', 'my very secret password');
<?php

require_once('config.php');
// ...
$mail->setLogin(SMTP_PRIMARY_EMAIL, SMTP_PRIMARY_PASSWORD);
// ...

It's also recommended to put the config outside the public web root if possible. This for example prevents people from including your PHP file remotely by a misconfiguration.

Note that the project description data, including the texts, logos, images, and/or trademarks, for each open source project belongs to its rightful owner. If you wish to add or remove any projects, please contact us at [email protected].