PDA

View Full Version : سوال: عدم ارسال ایمیل



Yalda2005
جمعه 22 آبان 1388, 17:46 عصر
مسئله ئی که هست اینه که من با استفاده از تابع mail attach ایمیل می فرستم اما ایمیل به کاربرانی که ایمیل غیر از یاهو دارند ارسال نمی شود . علتش چی می تونه باشه؟

walker
یک شنبه 24 آبان 1388, 11:41 صبح
من میخوام از mail() برای فرستادن ایمیل استفاده کنم.ولی مشکلات زیادی دارم.شنیدم که در smtp نمیشه از این تابع استفاده کرد.واقعا راهی وجود نداره که بتونم از این استفاده کنم.من میخوام تو یک حلقه به یک سری از کاربران ثبت نام کرده با این تابع میل بفرستم.چه کنم؟نیازمند راهنمایی هستم.

Yalda2005
دوشنبه 25 آبان 1388, 21:12 عصر
این هم کد :




<?php
function mail_attachment($filename, $path, $mailto, $from_mail, $from_name, $replyto, $subject, $message) {
$file = $path.$filename;
$file_size = filesize($file);
$handle = fopen($file, "r");
$content = fread($handle, $file_size);
fclose($handle);
$content = chunk_split(base64_encode($content));
$uid = md5(uniqid(time()));
$name = basename($file);
$header = "From: ".$from_name." <".$from_mail.">\r\n";
//$header .= "Bcc:".$my_bcc . "\r\n";
$header .= "Reply-To: ".$replyto."\r\n";
$header .= "MIME-Version: 1.0\r\n";
$header .= "Content-Type: multipart/mixed; boundary=\"".$uid."\"\r\n\r\n";
$header .= "This is a multi-part message in MIME format.\r\n";
$header .= "--".$uid."\r\n";
$header .= "Content-type:text/plain; charset=iso-8859-1\r\n";
$header .= "Content-Transfer-Encoding: 7bit\r\n\r\n";
$header .= $message."\r\n\r\n";
$header .= "--".$uid."\r\n";
$header .= "Content-Type: application/octet-stream; name=\"".$filename."\"\r\n"; // use diff. tyoes here
$header .= "Content-Transfer-Encoding: base64\r\n";
$header .= "Content-Disposition: attachment; filename=\"".$filename."\"\r\n\r\n";
$header .= $content."\r\n\r\n";
$header .= "--".$uid."--";
if (mail($mailto, $subject, "", $header)) {
echo "mail send shod ... OK"; // or use booleans here
} else {
echo "mail send ... ERROR!";
}
}
// how to use
$my_file = "classes.zip";
$my_path = $_SERVER['DOCUMENT_ROOT']."/upload/";
print $my_path;
$my_name = "test";
$my_mail = "info@daryabnokte.com";
$my_replyto = "info@.com";
$my_subject = "This is a mail with attachment.";
$mailto = "@hotmail.com" ;
//$my_bcc="@yahoo.com";
$my_message = "Hallo,\r\ndo you like this script? I hope it will help.\r\n\r\ngr. Olaf";
mail_attachment($my_file, $my_path, $mailto, $my_mail, $my_name, $my_replyto, $my_subject, $my_message);
?>




جای ایمیل ها رو عمدا خالی گذاشتم

__ziXet__
دوشنبه 25 آبان 1388, 21:17 عصر
این هم کد :




<?php
function mail_attachment($filename, $path, $mailto, $from_mail, $from_name, $replyto, $subject, $message) {
$file = $path.$filename;
$file_size = filesize($file);
$handle = fopen($file, "r");
$content = fread($handle, $file_size);
fclose($handle);
$content = chunk_split(base64_encode($content));
$uid = md5(uniqid(time()));
$name = basename($file);
$header = "From: ".$from_name." <".$from_mail.">\r\n";
//$header .= "Bcc:".$my_bcc . "\r\n";
$header .= "Reply-To: ".$replyto."\r\n";
$header .= "MIME-Version: 1.0\r\n";
$header .= "Content-Type: multipart/mixed; boundary=\"".$uid."\"\r\n\r\n";
$header .= "This is a multi-part message in MIME format.\r\n";
$header .= "--".$uid."\r\n";
$header .= "Content-type:text/plain; charset=iso-8859-1\r\n";
$header .= "Content-Transfer-Encoding: 7bit\r\n\r\n";
$header .= $message."\r\n\r\n";
$header .= "--".$uid."\r\n";
$header .= "Content-Type: application/octet-stream; name=\"".$filename."\"\r\n"; // use diff. tyoes here
$header .= "Content-Transfer-Encoding: base64\r\n";
$header .= "Content-Disposition: attachment; filename=\"".$filename."\"\r\n\r\n";
$header .= $content."\r\n\r\n";
$header .= "--".$uid."--";
if (mail($mailto, $subject, "", $header)) {
echo "mail send shod ... OK"; // or use booleans here
} else {
echo "mail send ... ERROR!";
}
}
// how to use
$my_file = "classes.zip";
$my_path = $_SERVER['DOCUMENT_ROOT']."/upload/";
print $my_path;
$my_name = "test";
$my_mail = "info@daryabnokte.com";
$my_replyto = "info@.com";
$my_subject = "This is a mail with attachment.";
$mailto = "@hotmail.com" ;
//$my_bcc="@yahoo.com";
$my_message = "Hallo,\r\ndo you like this script? I hope it will help.\r\n\r\ngr. Olaf";
mail_attachment($my_file, $my_path, $mailto, $my_mail, $my_name, $my_replyto, $my_subject, $my_message);
?>




جای ایمیل ها رو عمدا خالی گذاشتم
از کلاس phpmailer استفاده کن

Yalda2005
چهارشنبه 27 آبان 1388, 19:22 عصر
خب من می خوام اشکال این رو بفهمم ؟؟؟

Yalda2005
چهارشنبه 27 آبان 1388, 19:50 عصر
دوست عزیز شما کثیف کاری کد رو در نظر گیر و ببین به نظرت مشکل چیه ... اصل قضیه چیز دیگه ئی ... اون رو می شه با چند دقیقه وقت گذاشتن درست کرد