PDA

View Full Version : سوال: مشکل با PHP MAILER



amir99
چهارشنبه 18 اسفند 1389, 19:44 عصر
با سلام خدمت برنامه نویسان عزیز
من یک کد PHPMAILER دارم که زمانی که اونو روی سرورم نصب میکنم میل فرستاده میشه ولی بدون attachmnet مخواستم بدونم کسی میتونه کد من ادیت کنه که ان مشکل حل بشه هزینه اینکارم هر مقدار باشه پرداخت میشه
[[email:amir_bavarteam@yahoo.com


<html><head><title>madnet private mail-worker</title>
<meta http-equiv="Content-Type" content="text/html; charset=iso-8859-1"></head>
<center><body bgcolor="#FFFFFF" text="#000000"><hr>
<font color=red><b>(c) madnet private mail-worker (c)</b></font><br><hr>
<?
////////////////////////////////////////////////////////////////////////////////
ignore_user_abort(true);
set_time_limit (0);
ini_set('max_execution_time',0);
error_reporting(0);
$fileforlogs="log.txt";
////////////////////////////////////////////////////////////////////////////////
$action = $_POST['action'];
if ($action=="send")
{
$message = urlencode($message);
$message = ereg_replace("%5C%22", "%22", $message);
$message = urldecode($message);
$message = stripslashes($message);
$subject = stripslashes($subject);
}
?>
<form name="form1" method="post" action="" enctype="multipart/form-data"><br>
<table width="100%" border="0"><tr><td width="10%">
<div align="right"><font size="-3" face="Verdana, Arial, Helvetica, sans-serif">
Your Email:</font></div></td>
<td width="18%"><font size="-3" face="Verdana, Arial, Helvetica, sans-serif">
<input type="text" name="from" value="<? if (isset($from)) echo($from) ?>" size="30">
<input type="checkbox" name="random_mail" onClick="javascript:document.getElementById('from').style.d isplay=this.checked?'none':'';">Random EMails
</font></td>
<td width="31%">
<div align="right"><font size="-3" face="Verdana, Arial, Helvetica, sans-serif">
Your Name:</font></div></td>
<td width="41%"><font size="-3" face="Verdana, Arial, Helvetica, sans-serif">
<input type="text" name="realname" value="<? print $realname; ?>" size="30">
<input type="checkbox" name="random_name" onClick="javascript:document.getElementById('realname').sty le.display=this.checked?'none':'';">Random Names
</font></td></tr>
<tr><td width="10%">
<div align="right"><font size="-3" face="Verdana, Arial, Helvetica, sans-serif">Reply-To:</font></div></td>
<td width="18%"><font size="-3" face="Verdana, Arial, Helvetica, sans-serif">
<input type="text" name="replyto" value="<? print $replyto; ?>" size="30">
<input type="checkbox" name="random_reply" onClick="javascript:document.getElementById('replyto').styl e.display=this.checked?'none':'';">Random Replys-To
</font></td>
<td width="31%">
<div align="right"><font size="-3" face="Verdana, Arial, Helvetica, sans-serif">
Attach File:</font></div></td>
<td width="41%"><font size="-3" face="Verdana, Arial, Helvetica, sans-serif">
<input type="file" name="file" size="30"></font></td></tr><tr><td width="10%">
<div align="right"><font size="-3" face="Verdana, Arial, Helvetica, sans-serif">Subject:</font></div>
</td><td colspan="3"><font size="-3" face="Verdana, Arial, Helvetica, sans-serif">
<input type="text" name="subject" value="<? print $subject; ?>" size="90">
<input type="checkbox" name="random_sabj" onClick="javascript:document.getElementById('subject').styl e.display=this.checked?'none':'';">Random Subjects
</font></td>
<tr valign="top">
<td colspan="3"><font size="-3" face="Verdana, Arial, Helvetica, sans-serif">
<hr size="2" width="100%" align="right"><br>
<b>Message:</b>
<br>
<textarea name="message" cols="60" rows="10"><? if (isset($message)) echo($message); Else echo("Clear this and put Message"); ?>
</textarea><br>
<input type="radio" name="contenttype" value="plain" checked>Plain
<input type="radio" name="contenttype" value="html">HTML
<input type="hidden" name="action" value="send">
<input type="submit" value="Start Sending">
</font></td>
<td width="41%"><font size="-3" face="Verdana, Arial, Helvetica, sans-serif">
<hr size="2" width="100%" align="left"><br>
<b>E-mail List:</b>
<input type="checkbox" name="mails_from_file" onClick="javascript:document.getElementById('emaillist').st yle.display=this.checked?'none':'';document.getEle mentById('mailfilename').style.display=this.checke d?'':'none';">Load from file
<br>
<input type="input" name="mailfilename" value="filename" style="DISPLAY: none;">
<textarea name="emaillist" cols="30" rows="10"><? if (isset($emaillist)) echo($emaillist); Else echo("Clear this and put Email List"); ?>
</textarea>
<br>
<input type="checkbox" name="log_to_file">Save logs to file <u><? echo($fileforlogs)?></u>
</font></td></tr></table>
</form>
<?
function s() {
$word="qwrtpsdfghklzxcvbnm";
return $word[mt_rand(0,strlen($word)-1)];
}
function g() {
$word="eyuioa";
return $word[mt_rand(0,strlen($word)-2)];
}
function c() {
$word="1234567890";
return $word[mt_rand(0,strlen($word)-3)];
}
function a() {
$word=array('wa','sa','da','qa','ra','ta','pa','fa ','ga','ha','ja','ka','la','za','xa','ca','va','ba ','na','ma');
$ab1=count($word);
return $wq=$word[mt_rand(0,$ab1-1)];
}
function o() {
$word=array('wo','so','do','qo','ro','to','po','fo ','go','ho','jo','ko','lo','zo','xo','co','vo','bo ','no','mo');
$ab2=count($word);
return $wq2=$word[mt_rand(0,$ab2-1)];
}
function e() {
$word=array('we','se','de','qe','re','te','pe','fe ','ge','he','je','ke','le','ze','xe','ce','ve','be ','ne','me');
$ab3=count($word);
return $wq3=$word[mt_rand(0,$ab3-1)];
}
function i() {
$word=array('wi','si','di','qi','ri','ti','pi','fi ','gi','hi','ji','ki','li','zi','xi','ci','vi','bi ','ni','mi');
$ab4=count($word);
return $wq4=$word[mt_rand(0,$ab4-1)];
}
function u() {
$word=array('wu','su','du','qu','ru','tu','pu','fu ','gu','hu','ju','ku','lu','zu','xu','cu','vu','bu ','nu','mu');
$ab5=count($word);
return $wq5=$word[mt_rand(0,$ab5-1)];
}
function name0() {return c().c().c().c();}
function name1() {return a().s();}
function name2() {return o().s();}
function name3() {return e().s();}
function name4() {return i().s();}
function name5() {return u().s();}
function name6() {return a().s().g();}
function name7() {return o().s().g();}
function name8() {return e().s().g();}
function name9() {return i().s().g();}
function name10() {return u().s().g();}
function name11() {return a().s().g().s();}
function name12() {return o().s().g().s();}
function name13() {return e().s().g().s();}
function name14() {return i().s().g().s();}
function name15() {return u().s().g().s();}
function randword()
{
$cool=array(1,2,3,4,5,6,7,8,9,10,99,100,111,666,19 78,1979,1980,1981,1982,1983,1984,1985,1986,1987,19 88,1989,1990,1991,1992,1993,1994,1995,1996,1997,19 98,1999,2000,2001,2002,2003,2004,2005);
$func="name".mt_rand(0,15);
$func2="name".mt_rand(0,15);
switch (mt_rand(0,2))
{
case 0: return $func().$func2();
case 1: return $func().$cool[mt_rand(0,count($cool)-9)];
case 2: return $func();
default: return $func();
}
}
function randmail()
{
$domain=array('mail.com','hotmail.com','aol.com',' microsoft.com','yahoo.com','gmail.com','theglobean dmail.com','mail333.com','pmail.com','lycos.com',' royalmail.com','dailymail.co.uk','apple.com','imc. org','sun.com','hushmail.com','mozilla.org','world email.com','mailstart.com','cnn.com','operamail.co m','almail.com','netscape.com','email.com','latinm ail.com','bigmailbox.com','e-mps.org','internet.com','comcast.net','nova.edu');
$dom="@".$domain[mt_rand(0,29)];
return randword().$dom;
}
function randsabj()
{
$c=mt_rand(1,5);
$sabj="";
For($a=0;$a<=$c;$a++)
{
$sabj .= randword()." ";
}
return $sabj;
}
///////////////////////GET ENV//////////////////////////////////////////////////
if ($action=="send")
{
$from = $_POST['from'];
$subject = $_POST['subject'];
$message = $_POST['message'];
$emaillist = $_POST['emaillist'];
$random_mail = $_POST['random_mail'];
$random_name = $_POST['random_name'];
$realname = $_POST['realname'];
$replyto = $_POST['replyto'];
$random_reply = $_POST['random_reply'];
$subject = $_POST['subject'];
$random_sabj = $_POST['random_sabj'];
$mailfilename = $_POST['mailfilename'];
$mails_from_file = $_POST['mails_from_file'];
$log_to_file = $_POST['log_to_file'];
//////////////////////CHECK DATA////////////////////////////////////////////////
if ($random_mail!="on")
{ if (!$from)
{
echo("<font color=red>You mast enter your E-mail.</font>");
exit;
}
}
if ($random_name!="on")
{ if (!$realname)
{
echo("<font color=red>You mast enter your nName.</font>");
exit;
}
}
if ($random_reply!="on")
{ if (!$replyto)
{
echo("<font color=red>You mast enter your Reply-To field.</font>");
exit;
}
}
if ($random_sabj!="on")
{ if (!$subject)
{
echo("<font color=red>You mast enter Sabject.</font>");
exit;
}
}
If (!$message)
{
echo("<font color=red>You mast enter message to send.</font>");
exit;
}
if ($mails_from_file!="on")
{ if (!$emaillist)
{
echo("<font color=red>You mast enter E-mails where send mails.</font>");
exit;
}
}
Else
{
If (!file_exists($mailfilename))
{
echo("<font color=red>File \"".$mailfilename."\" with e-mail dosn't exists</font>");
exit;
}
}
////////////////////////////////////////////////////////////////////////////////
if ($mails_from_file!="on")
{
$allemails = split("\n", $emaillist);
$numemails = count($allemails);
}
Else
{
$allemails = file($mailfilename);
$numemails = count($allemails);
}

If ($file_name)
{
@copy($file, "./$file_name") or die("The file you are trying to upload couldn't be copied to the server");
$content = fread(fopen($file,"r"),filesize($file));
$content = chunk_split(base64_encode($content));
$uid = strtoupper(md5(uniqid(time())));
$name = basename($file);
}

if ($log_to_file=="on")
{
print "Work started<br>";
print "Logs saves in ".$fileforlogs."<br>";
flush();
}

for($x=0; $x<$numemails; $x++)
{
$to = $allemails[$x];
if ($to)
{
////////////////////////////////////////////////////////////////////////////////
if ($random_mail=="on")
{
$from = randmail();
}
if ($random_name=="on")
{
$realname = randword();
}
if ($random_reply=="on")
{
$replyto = randmail();
}
if ($random_sabj=="on")
{
$subject = randsabj();
}
////////////////////////////////////////////////////////////////////////////////
$to = ereg_replace(" ", "", $to);
$message = ereg_replace("&email&", $to, $message);
$subject = ereg_replace("&email&", $to, $subject);
if ($log_to_file!="on")
{
print "Sending mail to $to.......";
flush();
}
$header = "From: $realname <$from>\r\nReply-To: $replyto\r\n";
$header .= "MIME-Version: 1.0\r\n";
If ($file_name) $header .= "Content-Type: multipart/mixed; boundary=$uid\r\n";
If ($file_name) $header .= "--$uid\r\n";
$header .= "Content-Type: text/$contenttype\r\n";
$header .= "Content-Transfer-Encoding: 8bit\r\n\r\n";
$header .= "$message\r\n";
If ($file_name) $header .= "--$uid\r\n";
If ($file_name) $header .= "Content-Type: $file_type; name=\"$file_name\"\r\n";
If ($file_name) $header .= "Content-Transfer-Encoding: base64\r\n";
If ($file_name) $header .= "Content-Disposition: attachment; filename=\"$file_name\"\r\n\r\n";
If ($file_name) $header .= "$content\r\n";
If ($file_name) $header .= "--$uid--";
@mail($to, $subject, "", $header);
if ($log_to_file!="on")
{
print "ok<br>";
flush();
}
else
{
$fp = fopen ($fileforlogs, "w+");fwrite ($fp, ($x+1)." mails sended");fclose ($fp);
}
}
}
}
?>
<br><hr>
<style type="text/css">
<!--
.style1 {
font-size: 10px;
font-family: Geneva, Arial, Helvetica, sans-serif;
}
-->
</style>
<p class="style1"><u>madnet private mail-worker</u><br>
provided by <font color=green><u>madnet</u></font><br>
<font color=RED><b>ICQ: 751777</b> <a href="http://madnet.name">http://madnet.name</a></font><br>
PLEASE DON'T USE THIS SOFTWARE TO SPAM!, <br>
2005 of Octomber.<br>
The given script is written in the demonstration purposes. The author does not carry the responsibility for use of a script.</p>
</body>
</html>

رضا قربانی
پنج شنبه 19 اسفند 1389, 08:50 صبح
یعنی می گید فایل هم همراهش ارسال کنه ؟

amir99
پنج شنبه 19 اسفند 1389, 11:27 صبح
بله . نمیدونم چرا بر روی بعضی سرورها کار میکنه و بعضی نه .
میخواستم بدونم امکانش هست جای attachment مسیر یه فایل روی هاستو بدیم که ارسال کنه چون فک میکنم مشکلش با upload نشدنش روی هاست هست

رضا قربانی
پنج شنبه 19 اسفند 1389, 16:54 عصر
شما باید یه کاری کنید

اول اینکه اون فایلی که می خوایید برای طرف بفرستید روی وب سایت خودتون آپلودش کنید و بعد آدرس اون رو ایمیل کنی - به این صورت باید عمل کنید