09-09-2007, 17:02
|
|
|
חבר מתאריך: 27.08.07
הודעות: 26
|
|
ציטוט:
במקור נכתב על ידי david90
אוקיי ראיתי ובמידה ואני רוצה לשלוח לEMAIL איך אני עושה את זה?
ותודה על העזרה.
|
קוד PHP:
$to = "email@email.co.il"; $subject = "web mail"; $message = "this is an email.."; $attachment = "image.jpg" // הנתיב לקובץ $attachment_MIME_type = "image/jpg"; $handle = fopen($attachment, "rb"); $date = fread($handle, filesize($attachment)); fclose($handle); $boundary = "---Multipart_Boundary $headers = "\nMIME-Version: 1.0\n" . "Content-Type: multipart/mixed;\n" . " boundary=/"" . $boundary . "/""; $date = chuck_split(base64_encode($date)); $text = "--" . $boundary . "\n" . "Content-Type:text/plain\nContent-Transfer-Encoding: 7bit\n\n" . $message . "\n\n--" . $boundary . "\n" . "Content-Type: " . $attachment_MIME_type . ";\n name=\"" . $attachment . "\"\nContent-Transfer-Encoding: base64\n\n" . $date . "\n\n--" . $boundary . "--\n"; $result = @mail($to, $subject, $text, $headers); if ($result){ echo "the email was not sent"; }else{ echo "the email was sent"; }
מועתק מילה במילה מהספר PHP5 מדריך שימושי... יש מצב שעשיתי שגיאות כתיב ולכן זה לא יעבוד .. אז תרשום תגובה במידה ויש בעיה עם הקוד
|