Jump to content
Forumu Destekleyenlere Katılın ×
Paticik Forumları
2000 lerden beri faal olan, çok şukela bir paylaşım platformuyuz. Hoşgeldiniz.

php kodlama


Joker

Öne çıkan mesajlar

php den hiç anlamıyorum .net çiyimde, çok ufak bişey gerekti. elimde bir php ile mail gönderme kodu var ama çalıştıramadım. yapması gereken query string'ten parametreleri alıp mail göndermesi.


HATALAR :


Warning: include(SMTPClass.php) [function.include]: failed to open stream: No such file or directory in /home/emailhos/public_html/index.php on line 3

Warning: include(SMTPClass.php) [function.include]: failed to open stream: No such file or directory in /home/emailhos/public_html/index.php on line 3

Warning: include() [function.include]: Failed opening 'SMTPClass.php' for inclusion (include_path='.:/usr/lib/php:/usr/local/lib/php') in /home/emailhos/public_html/index.php on line 3

AYRICA Query deki to değişkenini de almayı başaramadım.


INDEX PHP :

<?php
include('SMTPconfig.php');
include('SMTPClass.php');
if($_SERVER[REQUEST_METHOD] == "POST")
{
$to = $_POST['to'];
$from = $_POST['from'];
$subject = $_POST['sub'];
$body = $_POST['message'];
$SMTPMail = new SMTPClient ($SmtpServer, $SmtpPort, $SmtpUser, $SmtpPass, $from, $to, $subject, $body);
$SMTPChat = $SMTPMail->SendMail();
}
?>
<form method="post" action="">
To:<input type="text" name="to" value="<?php $_GET['to'] ?>" />
From :<input type='text' name="from" />
Subject :<input type='text' name="sub" />
Message :<textarea name="message"></textarea>
<input type="submit" value=" Send " />
</form>


SMTPconfig.php :

<?php
//Server Address
$SmtpServer="mail.XXX.com";
$SmtpPort="587"; //default
$SmtpUser="[email protected]";
$SmtpPass="XXXX";
?>



SMTPClass.php :


<?php
class SMTPClient
{

function SMTPClient ($SmtpServer, $SmtpPort, $SmtpUser, $SmtpPass, $from, $to, $subject, $body)
{

$this->SmtpServer = $SmtpServer;
$this->SmtpUser = base64_encode ($SmtpUser);
$this->SmtpPass = base64_encode ($SmtpPass);
$this->from = $from;
$this->to = $to;
$this->subject = $subject;
$this->body = $body;

if ($SmtpPort == "")
{
$this->PortSMTP = 25;
}
else
{
$this->PortSMTP = $SmtpPort;
}
}

function SendMail ()
{
if ($SMTPIN = fsockopen ($this->SmtpServer, $this->PortSMTP))
{
fputs ($SMTPIN, "EHLO ".$HTTP_HOST."rn");
$talk[hello] = fgets ( $SMTPIN, 1024 );
fputs($SMTPIN, "auth loginrn");
$talk[res]=fgets($SMTPIN,1024);
fputs($SMTPIN, $this->SmtpUser."rn");
$talk[user]=fgets($SMTPIN,1024);
fputs($SMTPIN, $this->SmtpPass."rn");
$talk[pass]=fgets($SMTPIN,256);
fputs ($SMTPIN, "MAIL FROM: <".$this->from.">rn");
$talk[From] = fgets ( $SMTPIN, 1024 );
fputs ($SMTPIN, "RCPT TO: <".$this->to.">rn");
$talk[To] = fgets ($SMTPIN, 1024);
fputs($SMTPIN, "DATArn");
$talk[data]=fgets( $SMTPIN,1024 );
fputs($SMTPIN, "To: <".$this->to.">rnFrom: <".$this->from.">rnSubject:".$this->subject."rnrnrn".$this->body."rn.rn");
$talk[send]=fgets($SMTPIN,256);
//CLOSE CONNECTION AND EXIT ...
fputs ($SMTPIN, "QUITrn");
fclose($SMTPIN);
//
}
return $talk;
}
}
?>
Link to comment
Sosyal ağlarda paylaş

×
×
  • Yeni Oluştur...