J
|
Jane 12/3/2008 |
Hi, |
S
|
szjunior author 12/3/2008 |
Ok. Its working, but could you please help me again, what i have to change for send more than one field. function AfterEdit(&$values, $where, &$oldvalues, &$keys,$inline) { global $conn,$avalues; $to = $values["email"]; $from = 'L'; $sendto = "$to,$cc,$bcc"; $subject = $avalues["subject"]; $message = ""; $attach = $values["arq_xls"]; <---- here is the field number 1... $ext = str_replace('.','',strstr($attach, '.')); $loc = "files/$attach"; $fileatt = $loc; $fileatt_type = $ext; $fileatt_name = $attach; $headers = "To: $to\n" . "From: $from\n" . "cc: $cc\n" . "Bcc: $bcc\n" . "X-Mailer: PHP 5.x"; if ($fileatt) { $file = fopen($fileatt,'rb'); $data = fread($file,filesize($fileatt)); fclose($file); $semi_rand = md5(time()); $mime_boundary = "==Multipart_Boundary_x{$semi_rand}x"; $headers .= "\r\nMIME-Version: 1.0\n" . "Content-Type: multipart/mixed;\n" . " boundary=\"{$mime_boundary}\""; $message = "This is a multi-part message in MIME format.\n\n" . "--{$mime_boundary}\n" . "Content-Type: text/html; charset=\"iso-8859-1\"\n" . "Content-Transfer-Encoding: 7bit\n\n" . $message . "\n\n"; $data = chunk_split(base64_encode($data)); $message .= "--{$mime_boundary}\n" . "Content-Type: {$fileatt_type};\n" . " name=\"{$fileatt_name}\"\n" . //"Content-Disposition: attachment;\n" . //" filename=\"{$fileatt_name}\"\n" . "Content-Transfer-Encoding: base64\n\n" . $data . "\n\n" . "--{$mime_boundary}--\n"; } else { $semi_rand = md5(time()); $mime_boundary = "==Multipart_Boundary_x{$semi_rand}x"; $headers .= "\r\nMIME-Version: 1.0\n" . "Content-Type: multipart/mixed;\n" . " boundary=\"{$mime_boundary}\""; $message = "This is a multi-part message in MIME format.\n\n" . "--{$mime_boundary}\n" . "Content-Type: text/html; charset=\"iso-8859-1\"\n" . "Content-Transfer-Encoding: 7bit\n\n" . $message . "\n\n" . "--{$mime_boundary}--\n"; } $ok = @mail($sendto, $subject, $message, $headers); if ($ok) { echo "<p>sent -- $fileatt</p>"; } else { echo "<p>not sent!</p>"; } } |