[ cika007 @ 12.07.2007. 17:31 ] @
Znaci nikako ne mogu da posaljem attachment. Slanje plain text i html emaila prolazi bez problema ali attachment nikako. Gde gresim? config.php Code: <?php // Configuration settings for My Site // Email Settings $site['from_name'] = 'Moje ime'; // from email name $site['from_email'] = '[email protected]'; // from email address // Just in case we need to relay to a different server, // provide an option to use external mail server. $site['smtp_mode'] = 'enabled'; // enabled or disabled $site['smtp_host'] = '192.168.1.101'; $site['smtp_port'] = null; $site['smtp_username'] = null; ?> mailclass.inc Code: <?php require_once($_SERVER['DOCUMENT_ROOT'].'/lokalemail/lib/phpmailer/class.phpmailer.php'); class FreakMailer extends PHPMailer { var $priority = 3; var $to_name; var $to_email; var $From = null; var $FromName = null; var $Sender = null; function FreakMailer() { global $site; // Comes from config.php $site array if($site['smtp_mode'] == 'enabled') { $this->Host = $site['smtp_host']; $this->Port = $site['smtp_port']; if($site['smtp_username'] != '') { $this->SMTPAuth = true; $this->Username = $site['smtp_username']; $this->Password = $site['smtp_password']; } $this->Mailer = "smtp"; } if(!$this->From) { $this->From = $site['from_email']; } if(!$this->FromName) { $this-> FromName = $site['from_name']; } if(!$this->Sender) { $this->Sender = $site['from_email']; } $this->Priority = $this->priority; } } ?> htmltest.php Code: <?php //debug.php ini_set('display_errors', 1); error_reporting(E_ALL); $message = $_REQUEST["message"]; $od = $_REQUEST["email"]; $name = $_REQUEST["name"]; $subject = $_REQUEST["subject"]; $message = stripslashes($message); $htmlBody = '<html> <head> <title>My HTML Email</title> <style type="text/css"> div.kontejner { position: absolute; text-align: left; width: 800px; height: 650px; } div.image { position: absolute; text-align: left; margin-left: auto; margin-right: auto; width: 800px; height: 650px; } div.text { position: absolute; text-align: left; margin-left: auto; margin-right: auto; width: 669px; height: 164px; left: 85px; top: 142px; } </style> </head> <body> <div class="kontejner"> <div class="image"> <img src="http://localhost/lokalemail/model12.jpg" alt="Download picture" width="800" height="600" /><br /> </div> <div class="text"> <h2>neki tekst</h2> <p><strong>We</strong> invite you to visit <a href="http://www.xxx.com" title="naslov"></a> community of PHP Developers </p> </div> </div>'; // Validation if (! ereg('[A-Za-z0-9_-]', $name)) { echo 'Niste uneli Vase ime!'; exit; } if (! ereg('[A-Za-z0-9_-]+\@[A-Za-z0-9_-]+\.[A-Za-z0-9_-]+', $email)) { echo 'Niste uneli ispravnu email adresu!'; exit; } if (! ereg('[A-Za-z0-9_-]', $message)) { echo 'Niste uneli poruku!'; exit; } // Grab our config settings require_once($_SERVER['DOCUMENT_ROOT'].'/lokalemail/config.php'); // Grab the FreakMailer class require_once($_SERVER['DOCUMENT_ROOT'].'/lokalemail/lib/mailclass.inc'); // instantiate the class $mailer = new FreakMailer(); // Setup mail class, recipients and body // Set the subject $mailer->From = $od; $mailer->FromName = $name; $mailer->Subject = $subject; // Body $mailer->AddAttachment('/lokalemail/model12.jpg','model12.jpg'); $mailer->Body = $htmlBody; $mailer->isHTML(true); // Add an address to send to. $mailer->AddAddress ('[email protected]', 'Marko'); if(!$mailer->Send()) { echo 'Doslo je do greske pri slanju poruke. '; } else { echo 'Poruka je poslata!'; } $mailer->ClearAddresses(); $mailer->ClearAttachments(); ?> Hvala unapred. |