Vecina mailova biva poslata bez ikakvih problema, zajedno sa attachmentom.
jedini mail na koji stize poruka ali ne prikazuje attachment je gmail.com.
evo, stavicu i deo koda, mozda u njemu nesto nije u redu:
Code:
$sel="select * from sletter where time='1'";
$rs=mysql_query($sel);
while($m=mysql_fetch_array($rs))
{
$to = $m[1];
$random_hash = md5(date('r', time()));
$headers = "From: [email protected]\r\nReply-To: [email protected]";
$headers .= "\r\nContent-Type: multipart/mixed; boundary=\"PHP-mixed-".$random_hash."\"";
$attachment = chunk_split(base64_encode(file_get_contents($dokument)));
ob_start();
?>
--PHP-mixed-<?php echo $random_hash; ?>
Content-Type: multipart/alternative; boundary="PHP-alt-<?php echo $random_hash; ?>"
--PHP-alt-<?php echo $random_hash; ?>
Content-Type: text/plain; charset="utf-8"
Content-Transfer-Encoding: 7bit
--PHP-alt-<?php echo $random_hash; ?>
Content-Type: text/html; charset="utf-8"
Content-Transfer-Encoding: 7bit
<p><?php echo $msg; ?></p>
--PHP-alt-<?php echo $random_hash; ?>--
--PHP-mixed-<?php echo $random_hash; ?>
Content-Type: application/zip; name="<?php echo $dokument; ?>"
Content-Transfer-Encoding: base64
Content-Disposition: attachment
<?php echo $attachment; ?>
--PHP-mixed-<?php echo $random_hash; ?>--
<?php
$message = ob_get_clean();
$mail_sent = @mail( $to, $subject, $message, $headers );
}
$sel="select * from sletter where time='1'";
$rs=mysql_query($sel);
while($m=mysql_fetch_array($rs))
{
$to = $m[1];
$random_hash = md5(date('r', time()));
$headers = "From: [email protected]\r\nReply-To: [email protected]";
$headers .= "\r\nContent-Type: multipart/mixed; boundary=\"PHP-mixed-".$random_hash."\"";
$attachment = chunk_split(base64_encode(file_get_contents($dokument)));
ob_start();
?>
--PHP-mixed-<?php echo $random_hash; ?>
Content-Type: multipart/alternative; boundary="PHP-alt-<?php echo $random_hash; ?>"
--PHP-alt-<?php echo $random_hash; ?>
Content-Type: text/plain; charset="utf-8"
Content-Transfer-Encoding: 7bit
--PHP-alt-<?php echo $random_hash; ?>
Content-Type: text/html; charset="utf-8"
Content-Transfer-Encoding: 7bit
<p><?php echo $msg; ?></p>
--PHP-alt-<?php echo $random_hash; ?>--
--PHP-mixed-<?php echo $random_hash; ?>
Content-Type: application/zip; name="<?php echo $dokument; ?>"
Content-Transfer-Encoding: base64
Content-Disposition: attachment
<?php echo $attachment; ?>
--PHP-mixed-<?php echo $random_hash; ?>--
<?php
$message = ob_get_clean();
$mail_sent = @mail( $to, $subject, $message, $headers );
}
mislim, kod je verovatno ispravan jer na sve ostale mailove stize i poruka i prikacen fajl samo na gmail-u pravi problem.
prosao sam kroz celi forum ali nisam nasao odgovor na moje pitanje.
Nadam se da je jos neko imao ovaj problem i da ga je uspesno resio jer vecina mojih korisnika su na gmail-u.
edit by FlyLord: stavljeni code tagovi
[Ovu poruku je menjao flylord dana 19.01.2011. u 11:11 GMT+1]