summaryrefslogtreecommitdiff
path: root/app/Core/Mail/Transport/Smtp.php
blob: 7338a81efbab57441150df078560e83ade3a6561 (plain)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
<?php

namespace Kanboard\Core\Mail\Transport;

use Swift_SmtpTransport;

/**
 * PHP Mail Handler
 *
 * @package  Kanboard\Core\Mail\Transport
 * @author   Frederic Guillot
 */
class Smtp extends Mail
{
    /**
     * Get SwiftMailer transport
     *
     * @access protected
     * @return \Swift_Transport
     */
    protected function getTransport()
    {
        $transport = Swift_SmtpTransport::newInstance(MAIL_SMTP_HOSTNAME, MAIL_SMTP_PORT);
        $transport->setUsername(MAIL_SMTP_USERNAME);
        $transport->setPassword(MAIL_SMTP_PASSWORD);
        $transport->setEncryption(MAIL_SMTP_ENCRYPTION);

        if (HTTP_VERIFY_SSL_CERTIFICATE === false) {
            $transport->setStreamOptions(array(
                'ssl' => array(
                    'allow_self_signed' => true,
                    'verify_peer'       => false,
                    'verify_peer_name'  => false,
                )
            ));
        }

        return $transport;
    }
}