PHP code example of pushkar / easy-mail

1. Go to this page and download the library: Download pushkar/easy-mail 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/ */

    

pushkar / easy-mail example snippets




use EasyMail\Mail;

//Example 1

$mail = new Mail("[email protected]");
$mail->setSubject("Subject");
$mail->setMsg("Msg");
if($mail->sendMail()) {
    echo "Mail Sent.";
}

//Example 2

$mail = new Mail("[email protected]", "Subject", "Msg');
if($mail->sendMail()) {
    echo "Mail Sent.";
}

//Some methods

//For a reply-to header
$mail->addReplyTo("[email protected]", Name);

//For html email
$mail->isHtml(true);

//For adding custom header
$mail->customHeaders($header);

//set From
$mail->setFrom($email, $name);

//All methods
isValidEmail(string);
isHtml(bool);
setSubject(string);
setMsg(string);
addCC(string);
addBcc(string);
customHeader(string);
addReplyTo(string, string|null);
setFrom(string, string|null);
setPriority(int);
addAttachment(string);
setEncoding(string);
sendMail();