Photoshop Uzmanı - Türkiyenin Photoshop Portalı

Anasayfa arrow Dersler arrow PHP Dersleri arrow SMTP AUTH Email Gönderme

Dersler

 


Ders istekleri


Yeni Üyelerimiz

dsivdinc 12/05/08
aakcakaza 12/05/08
selmasel 12/05/08
kamilerdogan 12/05/08
.::begüm::. 12/05/08
eXTReMe Tracker
SMTP AUTH Email Gönderme PDF Yazdır E-posta
Salı, 21 Ağustos 2007
"SMTP AUTH Email Gönderme fonksiyonu ve örneği."

<?php
// Örnek Kullanım
$to = " Bu mail adresi spam botlara karşı korumalıdır, görebilmek için Javascript açık olmalıdır ";
$nameto = "Ayhan BARIS ";
$from = " Bu mail adresi spam botlara karşı korumalıdır, görebilmek için Javascript açık olmalıdır ";
$namefrom = "Gonderen Adı ";
$subject = "Mesaj Konusu ";
$message = "Mesaj"
authSendEmail($from, $namefrom, $to, $nameto, $subject, $message);
?>

<?php
/* * * * * * * * * * * * * * EMAIL GONDERME FONKSIYONLARI * * * * * * * * * * * * * */
//Authenticate Send - 21st March 2005
//This will send an email using auth smtp and output a log array
//logArray - connection,

function authSendEmail($from, $namefrom, $to, $nameto, $subject, $message)
{
//SMTP + SERVER DETAYLARI
/* * * * AYAR BASLANGICI* * * */
$smtpServer = "mail.server.com";
$port = "25";
$timeout = "30";
$username = "smtpusername";
$password = "smtppassword";
$localhost = "localhost";
$newLine = "\r\n";
/* * * * AYAR SONU * * * * */

//Connect to the host on the specified port
$smtpConnect = fsockopen($smtpServer, $port, $errno, $errstr, $timeout);
$smtpResponse = fgets($smtpConnect, 515);
if(empty(
$smtpConnect))
{
$output = "Baglantı Kurulamadı : $smtpResponse";
return
$output;
}
else
{
$logArray['connection'] = "Baglandı: $smtpResponse";
}

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

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

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

//Hello to SMTP
fputs($smtpConnect, "HELO $localhost" . $newLine);
$smtpResponse = fgets($smtpConnect, 515);
$logArray['heloresponse'] = "$smtpResponse";

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

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

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

//Headerlar
$headers = "MIME-Version: 1.0" . $newLine;
$headers .= "Content-type: text/html; charset=iso-8859-1" . $newLine;
$headers .= "To: $nameto <$to>" . $newLine;
$headers .= "From: $namefrom <$from>" . $newLine;

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

// Bye to SMTP
fputs($smtpConnect,"QUIT" . $newLine);
$smtpResponse = fgets($smtpConnect, 515);
$logArray['quitresponse'] = "$smtpResponse";
}
?>

Bu yazıyı web sayfanızda alıntılayın | Görüntüleme sayısı: 256

  Bu yazıya ilk yorumu yazın
RSS yorumları

Yorum yaz
  • Lütfen yorumunuzun yazının konusu ile alakalı olmasına dikkat edin.
  • Kişisel hakaret içeren yorumlar silinecektir.
  • Reklam amaçlı yorumlar silinecektir.
  • 'Gönder' düğmesine basmadan önce yeni bir güvenlik kodu üretmek için tarayıcınızın *Yenile* düğmesine basın.
  • Yukarıdaki durum yanlış güvenlik kodu girildiği durumlarda geçerlidir.
İsim:
E-posta:
Başlık:
BBCode:Web AddressEmail AddressLoad Image from WebBold TextItalic TextUnderlined TextQuoteCodeOpen ListList ItemClose List
Yorum:



Ek yorumlar konusunda bana e-posta aracılığı ile ulaşılmasını istiyorum.

Powered by AkoComment Tweaked Special Edition v.1.4.6
AkoComment © Copyright 2004 by Arthur Konze - www.mamboportal.com
All right reserved

 
< Önceki   Sonraki >