PHP Classes

File: example/index.php

Recommend this page to a friend!
  Classes of Boss Ibrahim Mussa   Wepesi Mailer   example/index.php   Download  
File: example/index.php
Role: Example script
Content type: text/plain
Description: Example script
Class: Wepesi Mailer
Send email messages using a configured SMTP server
Author: By
Last change:
Date: 2 years ago
Size: 716 bytes
 

 

Contents

Class file image Download
<?php

use Wepesi\Mailer\Email;
use
Wepesi\Mailer\smtpConfiguration;

include_once
__DIR__."/../vendor/autoload.php";

$smtpConfig = (new smtpConfiguration())
    ->
smtpServer("localhost")
    ->
smtpPort(25)
    ->
setUsername("[email protected]")
    ->
setPassword("p@ssW0rd")
    ->
organization("Wepesi")
    ->
generate();
$email = new Email($smtpConfig);
$email->from("[email protected]");
$email->to("[email protected]","wepesi");
$email->subject("Subject");
$email->text("Hello World");
$email->setBCC(["[email protected]","[email protected]"]);
$email->setCC(["[email protected]","[email protected]"]);
$result = $email->send();

if(isset(
$result['exception'])){
   
var_dump("email not sent");
}
var_dump($result);