Novo

Forum kao aplikacija na telefonu

Dodajte forum na početni ekran i koristite ga kao aplikaciju, sa menijem na dnu ekrana.

Koja (mala) PHP5 OOP klasa za slanje emaila?

Koja (mala) PHP5 OOP klasa za slanje emaila? 29.01.2008. u 22:53 · pre 229 meseci #1
Pozdrav svima,

Za potrebe jednog projekta (PHP5) potrebna mi je sto manja klasa koja može da se autentifikuje na SMTP server i pošalje HTML email (attachmenti nisu bitni).

Znam za "divove" poput PHP Mailera ili Swift Mailera ali treba mi što manja klasa. Gledao sam na PHPclasses.org ali nisam našao ništa odgovorajuće (ili su pisane za PHP4 ili nisu pisane u OOP maniru kao što je npr. PHP Mailer).

Može li neko da mi preporuči neku proverenu klasicu?

Unapred hvala!

:)
Potpis
Bolje 100 godina biti milioner nego nedelju dana siromašak
(c) Alan ford
Re: Koja (mala) PHP5 OOP klasa za slanje emaila? 30.01.2008. u 09:48 · pre 229 meseci #3
OK, hvala!

Imate li neku ideju koja klasa bi to mogla da bude, da je neko već koristio?

Pozz

:)
Potpis
Bolje 100 godina biti milioner nego nedelju dana siromašak
(c) Alan ford
Re: Koja (mala) PHP5 OOP klasa za slanje emaila? 30.01.2008. u 23:34 · pre 229 meseci
izmenjeno 1 put, poslednji put CtrlAltDel 31.01.2008. u 01:55
  1. CtrlAltDel31.01.2008. u 01:55zapis iz teksta poruke
#4
znam da nije klasa ali to vec mozes sam da pretabas kako ti odgovara...


Code:

<?
function saljimail($from, $to, $subject, $message)
{

// server konfiguracija

$smtpServer = "mail.vasdomen.com";
$username = "emailadresa";
$password = "sifra";

$port = "25";
$timeout = "30";
$localhost = "localhost";
$newLine = "\r\n";
//--------------------------------------------





//Konektovanje na port
$smtpConnect = fsockopen($smtpServer, $port, $errno, $errstr, $timeout);
$smtpResponse = fread($smtpConnect, 515); 
if(empty($smtpConnect)) 
{
$failed = "failed+"; 
$output = "Failed to connect:$smtpResponse"; 
return $output; 

}
else
{
$logArray['connection'] = "Connected: $smtpResponse";

}

//Kazi EHLO zbog EXIMA inace HELO
fputs($smtpConnect, "EHLO $localhost" . $newLine);
$smtpResponse = fgets($smtpConnect, 515);
$logArray['heloresponse'] = "$smtpResponse";


//zahtevaj autorizaciju
fputs($smtpConnect,"AUTH LOGIN" . $newLine);
$smtpResponse = fgets($smtpConnect, 515);
$logArray['authrequest'] = "$smtpResponse";

//salji korisnicko ime
fputs($smtpConnect, base64_encode($username) . $newLine);
$smtpResponse = fgets($smtpConnect, 515);
$logArray['authusername'] = "$smtpResponse";

//salji sifru
fputs($smtpConnect, base64_encode($password) . $newLine);
$smtpResponse = fgets($smtpConnect, 515);
$logArray['authpassword'] = "$smtpResponse";


//mail od
fputs($smtpConnect, "MAIL FROM: $from" . $newLine);
$smtpResponse = fgets($smtpConnect, 515);
$logArray['mailfromresponse'] = "$smtpResponse";

//mail ka
fputs($smtpConnect, "RCPT TO: $to" . $newLine);
$smtpResponse = fgets($smtpConnect, 515);
$logArray['mailtoresponse'] = "$smtpResponse";

//mail
fputs($smtpConnect, "DATA" . $newLine);
$smtpResponse = fgets($smtpConnect, 515);
$logArray['data1response'] = "$smtpResponse";

//hederi
$headers = "MIME-Version: 1.0" . $newLine;
$headers .= "Content-type: text/html; charset=windows-1250" . $newLine;
//$headers .= "To: $to" . $newLine;
$headers .= "From: $from" . $newLine;

fputs($smtpConnect, "To: $to\nFrom: $from\nSubject: $subject\n$headers\n\n$message\n.\n");
$smtpResponse = fgets($smtpConnect, 515);
$logArray['data2response'] = "$smtpResponse";

// zatvori SMTP
fputs($smtpConnect,"QUIT" . $newLine); 
$smtpResponse = fgets($smtpConnect, 515);
$logArray['quitresponse'] = "$smtpResponse"; 

echo '<pre>';

//izvestaj
//print_r($logArray);
}
?>

Prijavite se da biste odgovorili u ovoj temi.PrijavaRegistracija

Premeštanje teme