PHP code example of gaswelder / smtp

1. Go to this page and download the library: Download gaswelder/smtp library. Choose the download type require.

2. Extract the ZIP file and open the index.php.

3. Add this code to the index.php.
    
        
<?php
require_once('vendor/autoload.php');

/* Start to develop here. Best regards https://php-download.com/ */

    

gaswelder / smtp example snippets


use gaswelder\smtp\Client;
use gaswelder\smtp\Mail;

$mail = new Mail();
$mail->subject = "Hey there";
$mail->body = ";)";

$returnPath = "[email protected]";
$destinationPath = "[email protected]";

$smtp = new Client();
$smtp->connect("smtp.example.net");
$smtp->login("bob", "****");
$smtp->send($mail, $returnPath, $destinationPath);

use gaswelder\smtp\Client;
use gaswelder\smtp\Mail;

$mail = new Mail();
$mail->to = "To whom it might concern";
$mail->subject = "Viagra!";
$mail->body = ";)";

$recipients = [
	"[email protected]",
	"[email protected]",
	"[email protected]"
];
$smtp = new Client();
$smtp->connect("mail.net");
$smtp->login("mailer", "****");
$smtp->send($mail, "[email protected]", $recipients);

$client = new Client([
	'ssl' => [
		'allow_self_signed' => true
	]
]);

$client = new Client([
	'logger' => function($line) {
		fwrite(STDERR, $line."\n");
	}
]);