Advertisement
Not a member of Pastebin yet?
Sign Up,
it unlocks many cool features!
- static function send($prijemce,$predmet,$text, $priloha = NULL, $odesilatel = EMAIL) {
- require_once dirname(__FILE__).'/phpmailer.class.php';
- require_once dirname(__FILE__).'/../system/config/config.php';
- $mail = new PHPMailer();
- $header = "<img src='cid:HEADER' alt='NEEDFUL s.r.o. - Naše podlahy vydrží'>";
- $body = '<html>
- <head>
- <meta http-equiv="content-Type" content="text/html; charset=utf-8">
- <title>'.$predmet.'</title>
- </head>
- <div style="background: #f8f8f8; margin: 10px 0; font-family: Arial; line-height: 150%;">
- <div style="width: 600px; margin: auto; background: #fff; padding: 0 20px;">
- '.$header.'
- <div style="padding: 10px 0; border-bottom: 1px solid #ebebeb;">
- '.$text.'
- </div>
- <p style="color: #999999; font-size: 11px;">
- <a style="color: rgb(0, 139, 232);" href="http://www.'.DOMAIN.'/">www.'.DOMAIN.'</a><br />
- <strong>e-mail:</strong> <a style="color: rgb(0, 139, 232);">'.EMAIL.'</a>
- </p>
- </div>
- </div>
- </html>';
- $mail->AddReplyTo($odesilatel, DOMAIN);
- $mail->SetFrom($odesilatel, DOMAIN);
- $mail->AddReplyTo('dratkobeton@email.cz', DOMAIN);
- $mail->CharSet = "utf-8";
- $mail->Subject = $predmet;
- /*
- $mail->IsSMTP(); // použijeme k odeslání e-mailu SMTP server
- $mail->SMTPAuth = true; // je nutná SMTP autorizace
- $mail->Host = 'smtp-130651.m51.wedos.net'; // adresa SMTP serveru
- $mail->Port = 25;
- $mail->Username = 'info@needful.cz'; // uživatelské jméno
- $mail->Password = 'S4b1T+5t'; // uživatelské heslo
- $mail->SMTPDebug = 1;
- */
- if(!is_null($priloha)) {
- //$mail->AddAttachment("./nabidkys/".$priloha.".pdf", "NEEDFUL-cenova-nabidka-".date("Y-m-d").".pdf");
- //$mail->AddAttachment("./nabidkys/".$priloha.".pdf", "NEEDFUL-".friendly_url($predmet)."-".date("Y-m-d").".pdf", 'base64', 'application/pdf');
- $pp = "./nabidkys/".$priloha.".pdf";
- $pp2 = "NEEDFUL-".friendly_url($predmet)."-".date("Y-m-d").".pdf";
- $mail->AddAttachment($pp, basename($pp2));
- }
- // $mail->IsSMTP(); // telling the class to use SMTP
- // $mail->Host = SMTP; // SMTP server
- $mail->AddEmbeddedImage("./images/mail-header.png", "HEADER", "needful-header.png", "base64", "image/png");
- $mail->MsgHTML($body);
- $mail->IsHTML(true);
- $mail->AddAddress($prijemce);
- if(!$mail->Send()) {
- echo "E-mail (".$prijemce.") se nepodařilo odeslat: ".$mail->ErrorInfo;
- } else {
- //echo "Email (".$prijemce.") ok";
- }
- $mail->ClearAddresses();
- }
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement