1: <?php
2: /**
3: * Created by PhpStorm.
4: * User: manus
5: * Date: 10/5/16
6: * Time: 11:01
7: */
8:
9: namespace GLFramework\Mail;
10:
11:
12: class PHPMailer extends MailSystem
13: {
14: var $mail;
15: public function __construct(array $config)
16: {
17: parent::__construct($config);
18: // $this->mail = new \PHPMailer();
19: // //Enable SMTP debugging
20: // // 0 = off (for production use)
21: // // 1 = client messages
22: // // 2 = client and server messages
23: // $this->mail->SMTPDebug = 0;
24: // //Ask for HTML-friendly debug output
25: // $this->mail->Debugoutput = 'html';
26: //
27: // $this->mail->CharSet = 'UTF-8';
28: // //Set the hostname of the mail server
29: // $this->mail->Host = $config['mail']['hostname'];
30: // //Set the SMTP port number - likely to be 25, 465 or 587
31: // $this->mail->Port = $config['mail']['port'];
32: // //Whether to use SMTP authentication
33: // $this->mail->SMTPAuth = true;
34: // //Username to use for SMTP authentication
35: // $this->mail->Username = $config['mail']['username'];
36: // //Password to use for SMTP authentication
37: // $this->mail->Password = $config['mail']['password'];
38: // //Set who the message is to be sent from
39: // $this->mail->isSMTP();
40: //
41: // $this->mail->setFrom($config['mail']['from']['email'], $config['mail']['from']['title']);
42: }
43:
44:
45: public function getTransport()
46: {
47: $config = $this->config;
48: $transport = \Swift_SmtpTransport::newInstance($config['mail']['hostname'], $config['mail']['port']);
49: $transport->setUsername($config['mail']['username']);
50: $transport->setPassword($config['mail']['password']);
51: return $transport;
52: }
53: }