Commit 73993697ea6b5bf353d893d6229170d70862a88d

Authored by Alex Savenko
1 parent 85d06877

send test msg from arktika login

Showing 2 changed files with 32 additions and 39 deletions   Show diff stats
src/app/tasks/BasketTask.php
@@ -38,7 +38,7 @@ class BasketTask extends \Phalcon\CLI\Task @@ -38,7 +38,7 @@ class BasketTask extends \Phalcon\CLI\Task
38 38
39 $this->sendmail->abandonedBasket($email); 39 $this->sendmail->abandonedBasket($email);
40 40
41 - return 'Sended test msg'; 41 + return 'Sent test msg';
42 42
43 } 43 }
44 44
src/lib/sendmail.php
@@ -216,44 +216,37 @@ namespace @@ -216,44 +216,37 @@ namespace
216 216
217 public function abandonedBasket($email) { 217 public function abandonedBasket($email) {
218 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(); 219 + $email_from = 'Robot <robot@'.\config::get( 'global#domains/www' ).'>';
  220 +
  221 + $data_base =
  222 + [
  223 + 'email_to' => $email,
  224 + 'email_reply' => $email.' <'.$email.'>',
  225 + 'subject' => 'Test: '.\config::get( 'global#title' ),
  226 + 'message_body' => 'test'
  227 + ];
  228 +
  229 +
  230 +
  231 +
  232 + $header =
  233 + 'From: '.$email_from."\n".
  234 + 'Reply-To: '.$data_base['email_reply']."\n".
  235 + 'Return-Path: '.$data_base['email_reply']."\n".
  236 + 'MIME-Version: 1.0'."\n".
  237 + 'Content-type: text/html; charset=UTF-8'."\n".
  238 + 'Content-Transfer-Encoding: 8bit'."\n".
  239 + 'X-Mailer: PHP/' . phpversion();
  240 +
  241 + if( mail( $email, $data_base['subject'], $data_base['message_body'], $header, '-f '.$email_from ) )
  242 + {
  243 + return true;
  244 +
  245 + }
  246 + else
  247 + {
  248 + return false;
  249 + }
257 250
258 } 251 }
259 252