note 106637 added to function.imap-append

From: Date: Wed, 23 Nov 2011 19:45:53 +0000
Subject: note 106637 added to function.imap-append
Groups: php.notes 
Request: Send a blank email to php-notes+get-184642@lists.php.net to get a copy of this message
Here is how I used this function with an attachment. I used examples from everyone else but made it easier and cleaner to change. <?php $authhost="{000.000.000.000:993/validate-cert/ssl}Drafts"; $user="sadasd"; $pass="sadasd"; if ($mbox=imap_open( $authhost, $user, $pass)) { $dmy=date("d-M-Y H:i:s"); $filename="filename.pdf"; $attachment = chunk_split(base64_encode($filestring)); $boundary = "------=".md5(uniqid(rand())); $msg = ("From: Somebody\r\n" . "To: test@example.co.uk\r\n" . "Date: $dmy\r\n" . "Subject: This is the subject\r\n" . "MIME-Version: 1.0\r\n" . "Content-Type: multipart/mixed; boundary=\"$boundary\"\r\n" . "\r\n\r\n" . "--$boundary\r\n" . "Content-Type: text/html;\r\n\tcharset=\"ISO-8859-1\"\r\n" . "Content-Transfer-Encoding: 8bit \r\n" . "\r\n\r\n" . "Hello this is a test\r\n" . "\r\n\r\n" . "--$boundary\r\n" . "Content-Transfer-Encoding: base64\r\n" . "Content-Disposition: attachment; filename=\"$filename\"\r\n" . "\r\n" . $attachment . "\r\n" . "\r\n\r\n\r\n" . "--$boundary--\r\n\r\n"); imap_append($mbox,$authhost,$msg); imap_close($mbox); } else { echo "<h1>FAIL!</h1>\n"; } ?> Hope this helps someone. ---- Server IP: 69.147.83.197 Probable Submitter: 173.221.88.114 ---- Manual Page -- http://www.php.net/manual/en/function.imap-append.php Edit -- https://master.php.net/note/edit/106637 Del: integrated -- https://master.php.net/note/delete/106637/integrated Del: useless -- https://master.php.net/note/delete/106637/useless Del: bad code -- https://master.php.net/note/delete/106637/bad+code Del: spam -- https://master.php.net/note/delete/106637/spam Del: non-english -- https://master.php.net/note/delete/106637/non-english Del: in docs -- https://master.php.net/note/delete/106637/in+docs Del: other reasons-- https://master.php.net/note/delete/106637 Reject -- https://master.php.net/note/reject/106637 Search -- https://master.php.net/manage/user-notes.php

« previous php.notes (#184642) next »