Commit f5ed0556eb4182145bf834852f56412c197fe364
1 parent
73993697
merge conflict sendmail.php
Showing
1 changed file
with
66 additions
and
1 deletions
Show diff stats
src/lib/sendmail.php
... | ... | @@ -135,6 +135,17 @@ namespace |
135 | 135 | ]; |
136 | 136 | |
137 | 137 | break; |
138 | + case 10: //popup | |
139 | + | |
140 | + $data_base = | |
141 | + [ | |
142 | + 'email_to' => $data['email'], | |
143 | + 'email_reply' => $data['name'].' <'.$data['email'].'>', | |
144 | + 'subject' => 'Благодарим за подписку на сайте: '.\config::get( 'global#title' ), | |
145 | + 'message_body' => $view->getContent() | |
146 | + ]; | |
147 | + | |
148 | + break; | |
138 | 149 | |
139 | 150 | default: |
140 | 151 | return false; |
... | ... | @@ -214,6 +225,61 @@ namespace |
214 | 225 | |
215 | 226 | ///////////////////////////////////////////////////////////////////////////// |
216 | 227 | |
228 | + public function sendSubscribe($data) { | |
229 | + | |
230 | + $view = new \Phalcon\Mvc\View(); | |
231 | + $view->setViewsDir( ROOT_PATH.config::get( 'dirs/viewsDir' ) ); | |
232 | + | |
233 | + $view->start(); | |
234 | + | |
235 | + $view->setVar( 'data', $data ); | |
236 | + $view->render( 'sendmail', 'message_10' ); | |
237 | + | |
238 | + $view->finish(); | |
239 | + $message_body = $view->getContent(); | |
240 | + | |
241 | + $mail = new PHPMailer; | |
242 | + //Tell PHPMailer to use SMTP | |
243 | + $mail->isSMTP(); | |
244 | + //Enable SMTP debugging | |
245 | + // 0 = off (for production use) | |
246 | + // 1 = client messages | |
247 | + // 2 = client and server messages | |
248 | + $mail->SMTPDebug = 0; | |
249 | + //Ask for HTML-friendly debug output | |
250 | + $mail->Debugoutput = 'html'; | |
251 | + //Set the hostname of the mail server | |
252 | + $mail->Host = 'smtp.gmail.com'; | |
253 | + $mail->CharSet = 'UTF-8'; | |
254 | + // use | |
255 | + // $mail->Host = gethostbyname('smtp.gmail.com'); | |
256 | + // if your network does not support SMTP over IPv6 | |
257 | + //Set the SMTP port number - 587 for authenticated TLS, a.k.a. RFC4409 SMTP submission | |
258 | + $mail->Port = 587; | |
259 | + //Set the encryption system to use - ssl (deprecated) or tls | |
260 | + $mail->SMTPSecure = 'tls'; | |
261 | + //Whether to use SMTP authentication | |
262 | + $mail->SMTPAuth = true; | |
263 | + //Username to use for SMTP authentication - use full email address for gmail | |
264 | + $mail->Username = "arctic.semenainua@gmail.com"; | |
265 | + //Password to use for SMTP authentication | |
266 | + $mail->Password = "arctic0411"; | |
267 | + | |
268 | + //Set who the message is to be sent from | |
269 | + $mail->setFrom('semena@hs.kiev.ua', 'semena.in.ua'); | |
270 | + //Set who the message is to be sent to | |
271 | + $mail->addAddress($data['email'], $data['name']); | |
272 | + //Set the subject line | |
273 | + $mail->Subject = 'Благодарим за подписку!'; | |
274 | + //Read an HTML message body from an external file, convert referenced images to embedded, | |
275 | + //convert HTML into a basic plain-text alternative body | |
276 | + | |
277 | + $mail->msgHTML($message_body); | |
278 | + $mail->send(); | |
279 | + } | |
280 | + | |
281 | + ///////////////////////////////////////////////////////////////////////////// | |
282 | + | |
217 | 283 | public function abandonedBasket($email) { |
218 | 284 | |
219 | 285 | $email_from = 'Robot <robot@'.\config::get( 'global#domains/www' ).'>'; |
... | ... | @@ -249,7 +315,6 @@ namespace |
249 | 315 | } |
250 | 316 | |
251 | 317 | } |
252 | - | |
253 | 318 | } |
254 | 319 | } |
255 | 320 | ... | ... |