Advertisement
Guest User

Untitled

a guest
May 15th, 2018
265
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
PHP 2.91 KB | None | 0 0
  1. static function send($prijemce,$predmet,$text, $priloha = NULL, $odesilatel = EMAIL) {
  2.      
  3.         require_once dirname(__FILE__).'/phpmailer.class.php';
  4.         require_once dirname(__FILE__).'/../system/config/config.php';
  5.        
  6.         $mail = new PHPMailer();
  7.         $header = "<img src='cid:HEADER' alt='NEEDFUL s.r.o. - Naše podlahy vydrží'>";
  8.         $body = '<html>
  9.    <head>
  10.        <meta http-equiv="content-Type" content="text/html; charset=utf-8">
  11.        <title>'.$predmet.'</title>
  12.    </head>
  13.    <div style="background: #f8f8f8; margin: 10px 0; font-family: Arial; line-height: 150%;">
  14.          <div style="width: 600px; margin: auto; background: #fff; padding: 0 20px;">
  15.          '.$header.'
  16.            <div style="padding: 10px 0; border-bottom: 1px solid #ebebeb;">
  17.                '.$text.'
  18.            </div>
  19.            <p style="color: #999999; font-size: 11px;">
  20.                <a style="color: rgb(0, 139, 232);" href="http://www.'.DOMAIN.'/">www.'.DOMAIN.'</a><br />
  21.                <strong>e-mail:</strong> <a style="color: rgb(0, 139, 232);">'.EMAIL.'</a>
  22.            </p>
  23.          </div>
  24.        </div>
  25.    </html>';
  26.  
  27.         $mail->AddReplyTo($odesilatel, DOMAIN);
  28.         $mail->SetFrom($odesilatel, DOMAIN);
  29.         $mail->AddReplyTo('dratkobeton@email.cz', DOMAIN);
  30.         $mail->CharSet = "utf-8";
  31.         $mail->Subject = $predmet;
  32.        
  33.         /*
  34.             $mail->IsSMTP(); // použijeme k odeslání e-mailu SMTP server
  35.             $mail->SMTPAuth = true; // je nutná SMTP autorizace
  36.             $mail->Host = 'smtp-130651.m51.wedos.net'; // adresa SMTP serveru
  37.             $mail->Port       = 25;
  38.             $mail->Username = 'info@needful.cz'; // uživatelské jméno
  39.             $mail->Password = 'S4b1T+5t'; // uživatelské heslo
  40.             $mail->SMTPDebug  = 1;
  41.         */
  42.            
  43.         if(!is_null($priloha)) {
  44.             //$mail->AddAttachment("./nabidkys/".$priloha.".pdf", "NEEDFUL-cenova-nabidka-".date("Y-m-d").".pdf");
  45.             //$mail->AddAttachment("./nabidkys/".$priloha.".pdf", "NEEDFUL-".friendly_url($predmet)."-".date("Y-m-d").".pdf", 'base64', 'application/pdf');
  46.             $pp = "./nabidkys/".$priloha.".pdf";
  47.             $pp2 = "NEEDFUL-".friendly_url($predmet)."-".date("Y-m-d").".pdf";
  48.  
  49.             $mail->AddAttachment($pp, basename($pp2));
  50.    
  51.         }
  52.         // $mail->IsSMTP(); // telling the class to use SMTP
  53.         // $mail->Host       = SMTP; // SMTP server
  54.         $mail->AddEmbeddedImage("./images/mail-header.png", "HEADER", "needful-header.png", "base64", "image/png");
  55.         $mail->MsgHTML($body);
  56.         $mail->IsHTML(true);
  57.         $mail->AddAddress($prijemce);
  58.  
  59.         if(!$mail->Send()) {
  60.             echo "E-mail (".$prijemce.") se nepodařilo odeslat: ".$mail->ErrorInfo;
  61.         } else {
  62.             //echo "Email (".$prijemce.") ok";
  63.         }
  64.         $mail->ClearAddresses();
  65.     }
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement