Commit 85d06877c0f256f8bb7337e0783a137108c1c9c2

Authored by Alex Savenko
1 parent e5dcf9f8

send test msg from arktika login

@@ -106,10 +106,6 @@ $di->set( 'sendmail', function() @@ -106,10 +106,6 @@ $di->set( 'sendmail', function()
106 return new \sendmail(); 106 return new \sendmail();
107 }, true ); 107 }, true );
108 108
109 -$di->set('mailer', function ()  
110 -{  
111 - return new PHPMailer();  
112 -});  
113 109
114 ///////////////////////////////////////////////////////////// 110 /////////////////////////////////////////////////////////////
115 111
src/app/tasks/BasketTask.php
@@ -10,7 +10,7 @@ @@ -10,7 +10,7 @@
10 /** 10 /**
11 * Class BasketTask 11 * Class BasketTask
12 * @property \models $models 12 * @property \models $models
13 - * @property \PHPMailer $mailer 13 + * @property \sendmail $sendmail
14 * 14 *
15 */ 15 */
16 class BasketTask extends \Phalcon\CLI\Task 16 class BasketTask extends \Phalcon\CLI\Task
@@ -36,44 +36,7 @@ class BasketTask extends \Phalcon\CLI\Task @@ -36,44 +36,7 @@ class BasketTask extends \Phalcon\CLI\Task
36 36
37 $email = $user[0]['email']; 37 $email = $user[0]['email'];
38 38
39 - $mail = $this->mailer;  
40 - //Tell PHPMailer to use SMTP  
41 - $mail->isSMTP();  
42 - //Enable SMTP debugging  
43 - // 0 = off (for production use)  
44 - // 1 = client messages  
45 - // 2 = client and server messages  
46 - $mail->SMTPDebug = 0;  
47 - //Ask for HTML-friendly debug output  
48 - $mail->Debugoutput = 'html';  
49 - //Set the hostname of the mail server  
50 - $mail->Host = 'smtp.gmail.com';  
51 - $mail->CharSet = 'UTF-8';  
52 - // use  
53 - // $mail->Host = gethostbyname('smtp.gmail.com');  
54 - // if your network does not support SMTP over IPv6  
55 - //Set the SMTP port number - 587 for authenticated TLS, a.k.a. RFC4409 SMTP submission  
56 - $mail->Port = 587;  
57 - //Set the encryption system to use - ssl (deprecated) or tls  
58 - $mail->SMTPSecure = 'tls';  
59 - //Whether to use SMTP authentication  
60 - $mail->SMTPAuth = true;  
61 - //Username to use for SMTP authentication - use full email address for gmail  
62 - $mail->Username = "arctic.semenainua@gmail.com";  
63 - //Password to use for SMTP authentication  
64 - $mail->Password = "arctic0411";  
65 -  
66 - //Set who the message is to be sent from  
67 - $mail->setFrom('arctic.semenainua@gmail.com', 'semena.in.ua');  
68 - //Set who the message is to be sent to  
69 - $mail->addAddress($email);  
70 - //Set the subject line  
71 - $mail->Subject = 'test';  
72 - //Read an HTML message body from an external file, convert referenced images to embedded,  
73 - //convert HTML into a basic plain-text alternative body  
74 -  
75 - $mail->msgHTML('test');  
76 - $mail->send(); 39 + $this->sendmail->abandonedBasket($email);
77 40
78 return 'Sended test msg'; 41 return 'Sended test msg';
79 42
src/lib/sendmail.php
@@ -213,6 +213,50 @@ namespace @@ -213,6 +213,50 @@ namespace
213 } 213 }
214 214
215 ///////////////////////////////////////////////////////////////////////////// 215 /////////////////////////////////////////////////////////////////////////////
  216 +
  217 + public function abandonedBasket($email) {
  218 +
  219 + $mail = new PHPMailer;
  220 + //Tell PHPMailer to use SMTP
  221 + $mail->isSMTP();
  222 + //Enable SMTP debugging
  223 + // 0 = off (for production use)
  224 + // 1 = client messages
  225 + // 2 = client and server messages
  226 + $mail->SMTPDebug = 0;
  227 + //Ask for HTML-friendly debug output
  228 + $mail->Debugoutput = 'html';
  229 + //Set the hostname of the mail server
  230 + $mail->Host = 'smtp.gmail.com';
  231 + $mail->CharSet = 'UTF-8';
  232 + // use
  233 + // $mail->Host = gethostbyname('smtp.gmail.com');
  234 + // if your network does not support SMTP over IPv6
  235 + //Set the SMTP port number - 587 for authenticated TLS, a.k.a. RFC4409 SMTP submission
  236 + $mail->Port = 587;
  237 + //Set the encryption system to use - ssl (deprecated) or tls
  238 + $mail->SMTPSecure = 'tls';
  239 + //Whether to use SMTP authentication
  240 + $mail->SMTPAuth = true;
  241 + //Username to use for SMTP authentication - use full email address for gmail
  242 + $mail->Username = "arctic.semenainua@gmail.com";
  243 + //Password to use for SMTP authentication
  244 + $mail->Password = "arctic0411";
  245 +
  246 + //Set who the message is to be sent from
  247 + $mail->setFrom('arctic.semenainua@gmail.com', 'semena.in.ua');
  248 + //Set who the message is to be sent to
  249 + $mail->addAddress($email);
  250 + //Set the subject line
  251 + $mail->Subject = 'test';
  252 + //Read an HTML message body from an external file, convert referenced images to embedded,
  253 + //convert HTML into a basic plain-text alternative body
  254 +
  255 + $mail->msgHTML('test');
  256 + $mail->send();
  257 +
  258 + }
  259 +
216 } 260 }
217 } 261 }
218 262