PDA

View Full Version : مشکل در php mailer



jarmani
دوشنبه 22 مهر 1392, 17:31 عصر
با سلام خدمت اساتید
من phpmailer ,رو نصب و تنظبماتش رو انجام دادم و هم به یاهو و به جیمیل , ایمیل میفرسته
الان تنها مشکلی که داره اینه که ایمیلها اسپم میشه
چون سابجکت نداره و من هر کاری میکنم نمیتونم سابجکتشو درست کنم
هر ایمیلی که میاد به این صورت است info@site.com
کسی هست بدونه علت چیه؟؟؟

MMSHFE
دوشنبه 22 مهر 1392, 21:59 عصر
اینجا (http://barnamenevis.org/showthread.php?423653-%D8%AD%DB%8C%D8%A7%D8%AA%DB%8C-%D8%AE%D9%88%D8%A7%D9%87%D8%B4-%D8%A8%D8%B1%D8%A7%DB%8C-%D8%A7%D8%B5%D9%84%D8%A7%D8%AD-%DA%A9%D8%AF-%D8%B5%D9%81%D8%AD%D9%87-%D8%AA%D9%85%D8%A7%D8%B3-%D8%A8%D8%A7-%D9%85%D8%A7-%D9%88%D8%A8-%D8%B3%D8%A7%DB%8C%D8%AA-%D9%85%D9%86-%D8%A8%D8%A7-%D8%A7%D8%B3%D8%AA%D9%81%D8%A7%D8%AF%D9%87-%D8%A7%D8%B2-phpmailer&p=1895936&viewfull=1#post1895936) رو ببینید.

jarmani
سه شنبه 23 مهر 1392, 00:10 صبح
هر کاری کردم همه کدارو اینج بزارم نشد گفت بیشتر از 30000 کاراکتر است


<?php
class phpmailer
{

var $Priority = 3;
var $CharSet = "utf-8";
var $ContentType = "text/plain";
var $Encoding = "8bit";
var $ErrorInfo = "";
var $From = "root@localhost";
var $FromName = "Root User";
var $Sender = "hhhhhhh";
var $Subject = "gffgfgfg";
var $Body = "";
var $AltBody = "";
var $WordWrap = 0;
var $Mailer = "mail";
var $Sendmail = "/usr/sbin/sendmail";
var $PluginDir = "";
var $Version = "2.0.4";
var $ConfirmReadingTo = "";
var $Hostname = "";
var $MessageID = "";
var $Host = "localhost";
var $Port = 25;
var $Helo = "";
var $SMTPSecure = "";
var $SMTPAuth = false;
var $Username = "";
var $Password = "";
var $Timeout = 10;
var $SMTPDebug = false;
var $SMTPKeepAlive = false;
var $SingleTo = false;
var $smtp = NULL;
var $to = array( );
var $cc = array( );
var $bcc = array( );
var $ReplyTo = array( );
var $attachment = array( );
var $CustomHeader = array( );
var $message_type = "";
var $boundary = array( );
var $language = array( );
var $error_count = 0;
var $LE = "\n";
var $sign_cert_file = "";
var $sign_key_file = "";
var $sign_key_pass = "";

function ishtml( $bool )
{
if ( $bool == true )
{
$this->ContentType = "text/html";
}
else
{
$this->ContentType = "text/plain";
}
}

function issmtp( )
{
$this->Mailer = "smtp";
}

function ismail( )
{
$this->Mailer = "mail";
}

function issendmail( )
{
$this->Mailer = "sendmail";
}

function isqmail( )
{
$this->Sendmail = "/var/qmail/bin/sendmail";
$this->Mailer = "sendmail";
}

function addaddress( $address, $name = "" )
{
$cur = count( $this->to );
$this->to[$cur][0] = trim( $address );
$this->to[$cur][1] = $name;
}

function addcc( $address, $name = "" )
{
$cur = count( $this->cc );
$this->cc[$cur][0] = trim( $address );
$this->cc[$cur][1] = $name;
}

function addbcc( $address, $name = "" )
{
$cur = count( $this->bcc );
$this->bcc[$cur][0] = trim( $address );
$this->bcc[$cur][1] = $name;
}

function addreplyto( $address, $name = "" )
{
$cur = count( $this->ReplyTo );
$this->ReplyTo[$cur][0] = trim( $address );
$this->ReplyTo[$cur][1] = $name;
}

function send( )
{
$header = "";
$body = "";
$result = true;
if ( count( $this->to ) + count( $this->cc ) + count( $this->bcc ) < 1 )
{
$this->seterror( $this->lang( "provide_address" ) );
return false;
}
if ( empty( $this->AltBody ) )
{
$this->ContentType = "multipart/alternative";
}
$this->error_count = 0;
$this->setmessagetype( );
$header .= $this->createheader( );
$body = $this->createbody( );
if ( $body == "" )
{
return false;
}
switch ( $this->Mailer )
{
case "sendmail" :
$result = $this->sendmailsend( $header, $body );
break;
case "smtp" :
$result = $this->smtpsend( $header, $body );
break;
case "mail" :
$result = $this->mailsend( $header, $body );
break;
default :
$result = $this->mailsend( $header, $body );
}
return $result;
}

function sendmailsend( $header, $body )
{
if ( $this->Sender != "" )
{
$sendmail = sprintf( "%s -oi -f %s -t", escapeshellcmd( $this->Sendmail ), escapeshellarg( $this->Sender ) );
}
else
{
$sendmail = sprintf( "%s -oi -t", escapeshellcmd( $this->Sendmail ) );
}
if ( @( $mail = @popen( $sendmail, "w" ) ) )
{
$this->seterror( $this->lang( "execute" ).$this->Sendmail );
return false;
}
fputs( $mail, $header );
fputs( $mail, $body );
$result = pclose( $mail );
if ( version_compare( phpversion( ), "4.2.3" ) == -1 )
{
$result = $result >> 8 & 255;
}
if ( $result != 0 )
{
$this->seterror( $this->lang( "execute" ).$this->Sendmail );
return false;
}
return true;
}

function mailsend( $header, $body )
{
$to = "";
$i = 0;
for ( ; $i < count( $this->to ); ++$i )
{
if ( $i != 0 )
{
$to .= ", ";
}
$to .= $this->addrformat( $this->to[$i] );
}
$toArr = split( ",", $to );
$params = sprintf( "-oi -f %s", $this->Sender );
if ( $this->Sender != "" && strlen( ini_get( "safe_mode" ) ) < 1 )
{
$old_from = ini_get( "sendmail_from" );
ini_set( "sendmail_from", $this->Sender );
if ( $this->SingleTo === true && 1 < count( $toArr ) )
{
foreach ( $toArr as $key => $val )
{
$rt = @mail( $val, @$this->encodeheader( @$this->secureheader( @$this->Subject ) ), $body, $header, $params );
}
}
else
{
$rt = @mail( $to, @$this->encodeheader( @$this->secureheader( @$this->Subject ) ), $body, $header, $params );
}
}
else if ( $this->SingleTo === true && 1 < count( $toArr ) )
{
foreach ( $toArr as $key => $val )
{
$rt = @mail( $val, @$this->encodeheader( @$this->secureheader( @$this->Subject ) ), $body, $header, $params );
}
}
else
{
$rt = @mail( $to, @$this->encodeheader( @$this->secureheader( @$this->Subject ) ), $body, $header );
}
if ( isset( $old_from ) )
{
ini_set( "sendmail_from", $old_from );
}
if ( $rt )
{
$this->seterror( $this->lang( "instantiate" ) );
return false;
}
return true;
}

function smtpsend( $header, $body )
{
include_once( $this->PluginDir."smtp.php" );
$error = "";
$bad_rcpt = array( );
if ( $this->smtpconnect( ) )
{
return false;
}
$smtp_from = $this->Sender == "" ? $this->From : $this->Sender;
if ( $this->smtp->mail( $smtp_from ) )
{
$error = $this->lang( "from_failed" ).$smtp_from;
$this->seterror( $error );
$this->smtp->reset( );
return false;
}
$i = 0;
for ( ; $i < count( $this->to ); ++$i )
{
if ( $this->smtp->recipient( $this->to[$i][0] ) )
{
$bad_rcpt[] = $this->to[$i][0];
}
}
$i = 0;
for ( ; $i < count( $this->cc ); ++$i )
{
if ( $this->smtp->recipient( $this->cc[$i][0] ) )
{
$bad_rcpt[] = $this->cc[$i][0];
}
}
$i = 0;
for ( ; $i < count( $this->bcc ); ++$i )
{
if ( $this->smtp->recipient( $this->bcc[$i][0] ) )
{
$bad_rcpt[] = $this->bcc[$i][0];
}
}
if ( 0 < count( $bad_rcpt ) )
{
$i = 0;
for ( ; $i < count( $bad_rcpt ); ++$i )
{
if ( $i != 0 )
{
$error .= ", ";
}
$error .= $bad_rcpt[$i];
}
$error = $this->lang( "recipients_failed" ).$error;
$this->seterror( $error );
$this->smtp->reset( );
return false;
}
if ( $this->smtp->data( $header.$body ) )
{
$this->seterror( $this->lang( "data_not_accepted" ) );
$this->smtp->reset( );
return false;
}
if ( $this->SMTPKeepAlive == true )
{
$this->smtp->reset( );
}
else
{
$this->smtpclose( );
}
return true;
}

MMSHFE
سه شنبه 23 مهر 1392, 01:06 صبح
واقعاً اینهمه تنظیمات لازم نیست. لینکی که گذاشته بودم رو دیدین؟ همون تکه کد، به راحتی ایمیل رو میفرسته و نیازی به اینهمه دردسر نیست.

jarmani
چهارشنبه 24 مهر 1392, 23:34 عصر
سلام من همه این کار هارو کردم همه چی اوگی هست
مشکلی که هست اینه که وقتی کاربرا تو سایتم ثبت نام میکنند ایمیلی که واسشون ارسال میشه کد فعال سازیش کار نمیکه و در ضمن ایمیله هر کاری میکنم سابجکت نمیگیره ؟؟؟
دیگه خسته شدم :((((

shahriyar3
پنج شنبه 25 مهر 1392, 00:13 صبح
کل کلاس phpmailer گذاشتی اینجا چرا آخه؟!!
اون تیکه کدی که نوشتی از این کلاس استفاده میکنه رو بزار