PHP code example of hitraa / openforge-mailer

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

    

hitraa / openforge-mailer example snippets




use OpenForge\Mailer\Mailer;

$mail = new Mailer('smtp.yourhost.com', '[email protected]', 'password');

$mail->setFrom('Your Name <[email protected]>')
     ->setRecipient('[email protected]')
     ->setSubject('Hello!')
     ->setBody('This is the plain-text version.')
     ->setHTMLBody('<h1>Hello!</h1><p>This is the HTML version.</p>');

echo $mail->send();

$mail->setAttachment('/path/to/file.pdf');

$mail->enableTrackingPixel('https://yourdomain.com/track.php');

$mail->requestReadReceipt(true);

$mail->allowFallbackToMail(true);

$mail->setMessageIdPrefix('track-');

$mail->setRecipient(['[email protected]', '[email protected]']);

$mail->enableDebug(true);

openforge-mailer/
├── src/
│   └── Mailer.php
├── examples/
│   ├── basic-send.php
│   └── track.php
├── composer.json
├── LICENSE
└── README.md