PHP code example of pyrsmk / mail

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

    

pyrsmk / mail example snippets


$mail = new Mail;
$mail['from'] = '[email protected]';
$mail['to'] = '[email protected]';
$mail['subject'] = 'Hey, I saw you last night!';
$mail['body'] = 'I saw you. Or not.';
$mail->send();

$mail['from'] = array('Lionel McGonagall'=>'[email protected]');

$mail['to'] = array(
    'Peter' => '[email protected]',
    'Anaïs' => '[email protected]',
    'Grandma' => '[email protected]'
);

$mail['sender'] = '[email protected]';
$mail['replyto'] = '[email protected]';

$mail['html'] = '<h1>An awesome title for an awesome bill</h1>';
$mail['body'] = 'Your mail client does not support HTML rendering. So bad.';
$mail['attachments'] = array(__DIR__.'/my_generated_bill.pdf');

$mail['attachments'] = array(
	$_FILES['image1']['name'] => $_FILES['image1']['tmp_name'],
	$_FILES['image2']['name'] => $_FILES['image2']['tmp_name']
);

if(Mail::validate('[email protected]')){
    echo 'The e-mail address is valid';
}
else{
    echo 'The e-mail address is NOT valid';
}