PHP code example of devorto / mail-mailgun

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

    

devorto / mail-mailgun example snippets




use Devorto\Mail\Mail;
use Devorto\Mail\Recipient;
use Devorto\MailMailgun\Mailer;

   <title>Test mail</title>
</head>
<body>
    This is a test email, and you cannot respond to it :)
</body>
</html>
HTML;

$mail = (new Mail())
    ->setTo(new Recipient('[email protected]', 'Info'))
    ->setFrom(new Recipient('[email protected]', 'NoReply'))
    ->setSubject('Test mail')
    ->setMessage($message);

(new Mailer('mailgun-api-key', 'mailgun-api-url', 'mailgun-api-domain'))
    ->send($mail);